Best Python code snippet using tempest_python
test_segment_manager.py
Source:test_segment_manager.py
...315 with pytest.raises(Exception):316 result = segment_manager_server.post(317 '/promote', content_type='application/json',318 data=ujson.dumps({'segment': 'test_promotion'}))319def test_delete_segment(segment_manager_server):320 hdfs = hdfs3.HDFileSystem(settings['HDFS_HOST'], settings['HDFS_PORT'])321 rethinker = doublethink.Rethinker(322 servers=settings['RETHINKDB_HOSTS'], db='trough_configuration')323 # initially, segment doesn't exist324 result = segment_manager_server.delete('/segment/test_delete_segment')325 assert result.status_code == 404326 # provision segment327 result = segment_manager_server.post(328 '/provision', content_type='application/json',329 data=ujson.dumps({'segment':'test_delete_segment'}))330 assert result.status_code == 200331 assert result.mimetype == 'application/json'332 result_bytes = b''.join(result.response)333 result_dict = ujson.loads(result_bytes)...
test_segment.py
Source:test_segment.py
...31 policy.enforce(self.context, 'get_segment', self.target))32 def test_update_segment(self):33 self.assertTrue(34 policy.enforce(self.context, 'update_segment', self.target))35 def test_delete_segment(self):36 self.assertTrue(37 policy.enforce(self.context, 'delete_segment', self.target))38class SystemMemberTests(SystemAdminTests):39 def setUp(self):40 super(SystemMemberTests, self).setUp()41 self.context = self.system_member_ctx42 def test_create_segment(self):43 self.assertRaises(44 base_policy.PolicyNotAuthorized,45 policy.enforce,46 self.context, 'create_segment', self.target)47 def test_update_segment(self):48 self.assertRaises(49 base_policy.PolicyNotAuthorized,50 policy.enforce,51 self.context, 'update_segment', self.target)52 def test_delete_segment(self):53 self.assertRaises(54 base_policy.PolicyNotAuthorized,55 policy.enforce,56 self.context, 'delete_segment', self.target)57class SystemReaderTests(SystemMemberTests):58 def setUp(self):59 super(SystemReaderTests, self).setUp()60 self.context = self.system_reader_ctx61class ProjectAdminTests(SegmentAPITestCase):62 def setUp(self):63 super(ProjectAdminTests, self).setUp()64 self.context = self.project_admin_ctx65 def test_create_segment(self):66 self.assertRaises(67 base_policy.PolicyNotAuthorized,68 policy.enforce,69 self.context, 'create_segment', self.target)70 def test_get_segment(self):71 self.assertRaises(72 base_policy.PolicyNotAuthorized,73 policy.enforce,74 self.context, 'get_segment', self.target)75 def test_update_segment(self):76 self.assertRaises(77 base_policy.PolicyNotAuthorized,78 policy.enforce,79 self.context, 'update_segment', self.target)80 def test_delete_segment(self):81 self.assertRaises(82 base_policy.PolicyNotAuthorized,83 policy.enforce,84 self.context, 'delete_segment', self.target)85class ProjectMemberTests(ProjectAdminTests):86 def setUp(self):87 super(ProjectMemberTests, self).setUp()88 self.context = self.project_member_ctx89class ProjectReaderTests(ProjectMemberTests):90 def setUp(self):91 super(ProjectReaderTests, self).setUp()...
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!!