Best Python code snippet using tempest_python
test_roles_negative.py
Source:test_roles_negative.py
...46 self.assertRaises(lib_exc.BadRequest, self.roles_client.create_role,47 name='')48 @test.attr(type=['negative'])49 @test.idempotent_id('585c8998-a8a4-4641-a5dd-abef7a8ced00')50 def test_create_role_by_unauthorized_user(self):51 # Non-administrator user should not be able to create role52 role_name = data_utils.rand_name(name='role')53 self.assertRaises(lib_exc.Forbidden,54 self.non_admin_roles_client.create_role,55 name=role_name)56 @test.attr(type=['negative'])57 @test.idempotent_id('a7edd17a-e34a-4aab-8bb7-fa6f498645b8')58 def test_create_role_request_without_token(self):59 # Request to create role without a valid token should fail60 token = self.client.auth_provider.get_token()61 self.client.delete_token(token)62 role_name = data_utils.rand_name(name='role')63 self.assertRaises(lib_exc.Unauthorized,64 self.roles_client.create_role, name=role_name)...
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!!