Best Python code snippet using tempest_python
test_projects_negative.py
Source:test_projects_negative.py
...23 # Non-admin user should not be able to list projects24 self.assertRaises(exceptions.Unauthorized,25 self.non_admin_client.list_projects)26 @test.attr(type=['negative', 'gate'])27 def test_project_create_duplicate(self):28 # Project names should be unique29 project_name = data_utils.rand_name('project-dup-')30 project = self.client.create_project(project_name)31 self.data.projects.append(project)32 self.assertRaises(33 exceptions.Conflict, self.client.create_project, project_name)34 @test.attr(type=['negative', 'gate'])35 def test_create_project_by_unauthorized_user(self):36 # Non-admin user should not be authorized to create a project37 project_name = data_utils.rand_name('project-')38 self.assertRaises(39 exceptions.Unauthorized, self.non_admin_client.create_project,40 project_name)41 @test.attr(type=['negative', 'gate'])...
test_sa_example.py
Source:test_sa_example.py
...37 expected = {'id': PR_ID,38 'links': {'self': 'http://localhost/projects/%s/' % PR_ID},39 'name': u'new_name'}40 self.assertEqual(result.json, expected)41 def test_project_create_duplicate(self):42 with self.assertRaises(IntegrityError):43 self.app.post('/projects', {'name': PROJECT_NAME})44 def test_project_replace_existing(self):45 result = self.app.put('/projects/%s' % PR_ID, {'name': 'new_name'})46 expected = {'id': PR_ID,47 'links': {'self': 'http://localhost/projects/%s/' % PR_ID},48 'name': u'new_name'}49 self.assertEqual(result.json, expected)50 def test_project_replace_inexisting(self):51 from example.ext.sqla.model import Project52 result = self.app.put('/projects/999', {'name': 'new_name'})53 expected = {'id': '999', # XXX Fixme: must be an integer54 'links': {'self': 'http://localhost/projects/999/'},55 'name': u'new_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!!