Best Python code snippet using tempest_python
test_agents.py
Source:test_agents.py  
...62        body = self.client.update_agent(agent_id, **params)['agent']63        for expected_item, value in params.items():64            self.assertEqual(value, body[expected_item])65    @test.idempotent_id('470e0b89-386f-407b-91fd-819737d0b335')66    def test_delete_agent(self):67        # Create an agent and delete it.68        body = self.client.create_agent(**self.params_agent)['agent']69        self.client.delete_agent(body['agent_id'])70        # Verify the list doesn't contain the deleted agent.71        agents = self.client.list_agents()['agents']72        self.assertNotIn(body['agent_id'], map(lambda x: x['agent_id'],73                                               agents))74    @test.idempotent_id('6a326c69-654b-438a-80a3-34bcc454e138')75    def test_list_agents(self):76        # Create an agent and  list all agents.77        body = self.client.create_agent(**self.params_agent)['agent']78        self.addCleanup(self.client.delete_agent, body['agent_id'])79        agents = self.client.list_agents()['agents']80        self.assertGreater(len(agents), 0,81                           'Cannot get any agents.(%s)' % agents)82        self.assertIn(body['agent_id'], map(lambda x: x['agent_id'], agents))83    @test.idempotent_id('eabadde4-3cd7-4ec4-a4b5-5a936d2d4408')...test_agents_rbac.py
Source:test_agents_rbac.py  
...90    @rbac_rule_validation.action(91        service="nova",92        rules=[_AGENTS_DELETE])93    @decorators.idempotent_id('c5042af8-0682-43b0-abc4-bf33349e23dd')94    def test_delete_agent(self):95        params = self._param_helper(96            hypervisor='common', os='linux',97            architecture='x86_64', version='7.0',98            url='xxx://xxxx/xxx/xxx',99            md5hash='add6bb58e139be103324d04d82d8f545')100        body = self.agents_client.create_agent(**params)['agent']101        self.addCleanup(test_utils.call_and_ignore_notfound_exc,102                        self.agents_client.delete_agent,103                        body['agent_id'])104        with self.override_role():...urls.py
Source:urls.py  
1from django.urls import path2from . import views3urlpatterns = [4        path('replay', views.replay, name='replay'),5        path('launch', views.launch, name='launch'),6        path('query_agent_payoff', views.query_agent_payoff, name='query_agent_payoff'),7        path('query_payoff', views.query_payoff, name='query_payoff'),8        path('query_game', views.query_game, name='query_game'),9        path('upload_agent', views.upload_agent, name='upload_agent'),10        path('delete_agent', views.delete_agent, name='delete_agent'),11        path('list_uploaded_agents', views.list_uploaded_agents, name='list_uploaded_agents'),12        path('list_baseline_agents', views.list_baseline_agents, name='list_baseline_agents'),13        path('download_examples', views.download_examples, name='download_examples'),...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
