Best Python code snippet using tempest_python
test_service_provider.py
Source:test_service_provider.py
...60 exist61 """62 pass63 @abc.abstractmethod64 def test_identity_delete_service_provider(self):65 """Test identity:delete_service_provider policy.66 This test must check67 * whether the persona can delete a service provider68 * whether the persona can delete a service provider that does not69 exist70 """71 pass72class SystemAdminTests(IdentityV3RbacServiceProviderTests,73 base.BaseIdentityTest):74 credentials = ['system_admin']75 def test_identity_create_service_provider(self):76 sp_id = self.do_request(77 'create_service_provider', expected_status=201,78 sp_id=data_utils.rand_name(),79 auth_url=data_utils.rand_url(),80 sp_url=data_utils.rand_url()81 )['service_provider']['id']82 self.addCleanup(self.admin_sp_client.delete_service_provider, sp_id)83 def test_identity_get_service_provider(self):84 sp_id = self.admin_sp_client.create_service_provider(85 sp_id=data_utils.rand_name(),86 auth_url=data_utils.rand_url(),87 sp_url=data_utils.rand_url())['service_provider']['id']88 self.addCleanup(self.admin_sp_client.delete_service_provider, sp_id)89 self.do_request('show_service_provider', sp_id=sp_id)90 # user gets a 404 for nonexistent sp91 self.do_request('show_service_provider',92 expected_status=exceptions.NotFound,93 sp_id=data_utils.rand_uuid_hex())94 def test_identity_list_service_providers(self):95 sp_id = self.admin_sp_client.create_service_provider(96 sp_id=data_utils.rand_name(),97 auth_url=data_utils.rand_url(),98 sp_url=data_utils.rand_url())['service_provider']['id']99 self.addCleanup(self.admin_sp_client.delete_service_provider, sp_id)100 resp = self.do_request('list_service_providers')101 self.assertIn(sp_id, [i['id'] for i in resp['service_providers']])102 def test_identity_update_service_provider(self):103 sp_id = self.admin_sp_client.create_service_provider(104 sp_id=data_utils.rand_name(),105 auth_url=data_utils.rand_url(),106 sp_url=data_utils.rand_url())['service_provider']['id']107 self.addCleanup(self.admin_sp_client.delete_service_provider, sp_id)108 self.do_request('update_service_provider',109 sp_id=sp_id,110 description=data_utils.arbitrary_string())111 # user gets a 404 for nonexistent sp112 self.do_request('update_service_provider',113 expected_status=exceptions.NotFound,114 sp_id=data_utils.rand_uuid_hex(),115 description=data_utils.arbitrary_string())116 def test_identity_delete_service_provider(self):117 sp_id = self.admin_sp_client.create_service_provider(118 sp_id=data_utils.rand_name(),119 auth_url=data_utils.rand_url(),120 sp_url=data_utils.rand_url())['service_provider']['id']121 self.do_request('delete_service_provider', expected_status=204,122 sp_id=sp_id)123 # user gets a 404 for nonexistent sp124 self.do_request('delete_service_provider',125 expected_status=exceptions.NotFound,126 sp_id=sp_id)127class SystemMemberTests(SystemAdminTests, base.BaseIdentityTest):128 credentials = ['system_member', 'system_admin']129 def test_identity_create_service_provider(self):130 self.do_request('create_service_provider',131 expected_status=exceptions.Forbidden,132 sp_id=data_utils.rand_name(),133 auth_url=data_utils.rand_url(),134 sp_url=data_utils.rand_url())135 def test_identity_update_service_provider(self):136 sp_id = self.admin_sp_client.create_service_provider(137 sp_id=data_utils.rand_name(),138 auth_url=data_utils.rand_url(),139 sp_url=data_utils.rand_url())['service_provider']['id']140 self.addCleanup(self.admin_sp_client.delete_service_provider, sp_id)141 self.do_request('update_service_provider',142 expected_status=exceptions.Forbidden,143 sp_id=sp_id,144 description=data_utils.arbitrary_string())145 # user gets a 403 for nonexistent sp146 self.do_request('update_service_provider',147 expected_status=exceptions.Forbidden,148 sp_id=data_utils.rand_uuid_hex(),149 description=data_utils.arbitrary_string())150 def test_identity_delete_service_provider(self):151 sp_id = self.admin_sp_client.create_service_provider(152 sp_id=data_utils.rand_name(),153 auth_url=data_utils.rand_url(),154 sp_url=data_utils.rand_url())['service_provider']['id']155 self.addCleanup(self.admin_sp_client.delete_service_provider, sp_id)156 self.do_request('delete_service_provider',157 expected_status=exceptions.Forbidden,158 sp_id=sp_id)159 # user gets a 403 for nonexistent sp160 self.do_request('delete_service_provider',161 expected_status=exceptions.Forbidden,162 sp_id=sp_id)163class SystemReaderTests(SystemMemberTests):164 credentials = ['system_reader', 'system_admin']...
urls.py
Source:urls.py
1import django2from django.conf.urls import url3from django.urls import path4from django.http import request5from SuvisethApp import views6from django.conf import settings7from django.conf.urls.static import static8#TEMPLATE TAGGING9app_name = 'SuvisethApp'10urlpatterns = [11 path('signup',views.signUp,name='signup'),12 path('signin',views.signIn,name='signin'),13 path('client_signup',views.clientSignup,name='client_signup'),14 path('sprovider_signup',views.sproviderSignup,name='sprovider_signup'),15 path('admin_signup',views.adminSignup,name='admin_signup'),16 path('client_signin',views.clientSignin,name='client_signin'),17 path('sprovider_signin',views.sproviderSignin,name='sprovider_signin'),18 path('admin_signin',views.adminSignin,name='admin_signin'),19 path('signout',views.user_logout,name='signout'),20 path('wedding_services',views.weddingServices,name='wedding_services'),21 path('find_partner',views.findPartner,name='find_partner'),22 path('categories',views.categories,name='categories'),23 path('category/<str:category_id>',views.category,name='category'),24 path('add_category',views.add_category,name='add_category'),25 path('edit_category/<str:category_id>',views.edit_category,name='edit_category'),26 path('delete_category/<str:category_id>',views.delete_category,name='delete_category'),27 path('all_service_providers',views.service_providers,name='all_service_providers'),28 path('all_service_provider/<str:sp_id>',views.service_provider,name='service_provider'),29 path('edit_service_provider/<str:sp_id>',views.edit_service_provider,name='edit_service_provider'),30 path('delete_service_provider/<str:sp_id>',views.delete_service_provider,name='delete_service_provider'),31 path('all_customers',views.customers,name='customers'),32 path('customer/<str:c_id>',views.customer,name='customer'),33 path('deactivate_account/<str:c_id>',views.remove_customer,name='remove_customer'),...
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!!