Best Python code snippet using tempest_python
test_consumer.py
Source:test_consumer.py
...54 * whether the persona can update a55 """56 pass57 @abc.abstractmethod58 def test_identity_delete_consumer(self):59 """Test identity:delete_consumer policy.60 This test must check61 * whether the persona can delete a consumer62 """63 pass64class SystemAdminTests(65 IdentityV3RbacOauth1ConsumerTest, base.BaseIdentityTest):66 credentials = ['system_admin']67 def test_identity_create_consumer(self):68 resp = self.do_request('create_consumer',69 expected_status=201,70 **self.consumer())71 self.addCleanup(self.client.delete_consumer,72 resp['consumer']['id'])73 def test_identity_get_consumer(self):74 consumer = self.admin_client.create_consumer(75 **self.consumer())['consumer']76 self.addCleanup(self.admin_client.delete_consumer, consumer['id'])77 resp = self.do_request('show_consumer', consumer_id=consumer['id'])78 self.assertEqual(resp['consumer']['id'], consumer['id'])79 def test_identity_list_consumers(self):80 consumer = self.admin_client.create_consumer(81 **self.consumer())['consumer']82 self.addCleanup(self.admin_client.delete_consumer, consumer['id'])83 resp = self.do_request('list_consumers')84 self.assertIn(consumer['id'], set(c['id'] for c in resp['consumers']))85 def test_identity_update_consumer(self):86 consumer = self.client.create_consumer(**self.consumer())['consumer']87 self.addCleanup(self.client.delete_consumer, consumer['id'])88 self.do_request('update_consumer',89 consumer_id=consumer['id'],90 description=data_utils.arbitrary_string())91 def test_identity_delete_consumer(self):92 consumer = self.client.create_consumer(**self.consumer())['consumer']93 self.do_request('delete_consumer',94 expected_status=204,95 consumer_id=consumer['id'])96class SystemMemberTests(SystemAdminTests):97 credentials = ['system_member', 'system_admin']98 def test_identity_create_consumer(self):99 self.do_request('create_consumer',100 expected_status=exceptions.Forbidden,101 **self.consumer())102 def test_identity_update_consumer(self):103 consumer = self.admin_client.create_consumer(104 **self.consumer())['consumer']105 self.addCleanup(self.admin_client.delete_consumer, consumer['id'])106 self.do_request('update_consumer',107 expected_status=exceptions.Forbidden,108 consumer_id=consumer['id'],109 description=data_utils.arbitrary_string())110 def test_identity_delete_consumer(self):111 consumer = self.admin_client.create_consumer(112 **self.consumer())['consumer']113 self.do_request('delete_consumer',114 expected_status=exceptions.Forbidden,115 consumer_id=consumer['id'])116class SystemReaderTests(SystemMemberTests):117 credentials = ['system_reader', 'system_admin']118class DomainAdminTests(SystemMemberTests):119 credentials = ['domain_admin', 'system_admin']120 def test_identity_get_consumer(self):121 consumer = self.admin_client.create_consumer(122 **self.consumer())['consumer']123 self.addCleanup(self.admin_client.delete_consumer, consumer['id'])124 self.do_request('show_consumer',...
test_oauth_consumers_rbac.py
Source:test_oauth_consumers_rbac.py
...35 self._create_consumer()36 @rbac_rule_validation.action(service="keystone",37 rule="identity:delete_consumer")38 @decorators.idempotent_id('0f148510-63bf-11e6-4522-080044d0d971')39 def test_delete_consumer(self):40 consumer = self._create_consumer()41 self.rbac_utils.switch_role(self, toggle_rbac_role=True)42 self.consumers_client.delete_consumer(consumer['id'])43 @rbac_rule_validation.action(service="keystone",44 rule="identity:update_consumer")45 @decorators.idempotent_id('0f148510-63bf-11e6-4522-080044d0d972')46 def test_update_consumer(self):47 consumer = self._create_consumer()48 new_description = data_utils.rand_name(49 self.__class__.__name__ + '-test_consumer')50 self.rbac_utils.switch_role(self, toggle_rbac_role=True)51 self.consumers_client.update_consumer(consumer['id'],52 new_description)53 @rbac_rule_validation.action(service="keystone",54 rule="identity:get_consumer")55 @decorators.idempotent_id('0f148510-63bf-11e6-4522-080044d0d973')56 def test_show_consumer(self):...
urls.py
Source:urls.py
1from django.conf.urls import include, url2from django.contrib import admin3import sdios_lti.views4urlpatterns = [5 url(r"^$", sdios_lti.views.index, name="index"),6 url(r"^login/$", sdios_lti.views.login, name="login"),7 url(r"^logout/$", sdios_lti.views.logout, name="logout"),8 url(r"^sdis/$", sdios_lti.views.view_environments, name="sdis"),9 url(r"^sdis/export/$", sdios_lti.views.export_environment, name="export_environment"),10 url(r"^sdis/remove/(?P<sdi_id>[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})/$", sdios_lti.views.remove_lti_access, name="remove_lti_access"),11 url(r"^consumers/$", sdios_lti.views.view_consumers, name="consumers"),12 url(r"^consumers/add_consumer/$", sdios_lti.views.add_consumer, name="add_consumer"),13 url(r"^consumers/delete_consumer/$", sdios_lti.views.delete_consumer, name="delete_consumer"),14 url(r"^users/$", sdios_lti.views.view_users, name="users"),15 url(r"^settings/$", sdios_lti.views.manage_settings, name="settings"),16 url(r"^lti/$", sdios_lti.views.lti, name="lti"),17 url(r"^admin/", admin.site.urls, name="admin"),...
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!!