Best Python code snippet using tempest_python
test_segments_rbac.py
Source:test_segments_rbac.py
...75 @rbac_rule_validation.action(service="neutron",76 rules=["get_segment",77 "update_segment"],78 expected_error_codes=[404, 403])79 def test_update_segment(self):80 """Update segment.81 RBAC test for the neutron "update_segment" policy82 """83 segment = self.create_segment(self.network)84 with self.override_role():85 self.ntp_client.update_segment(segment['segment']['id'],86 name="NewName")87 @decorators.idempotent_id('c02618e7-bb20-1a3a-83c8-6eec2af08129')88 @rbac_rule_validation.action(service="neutron",89 rules=["get_segment",90 "delete_segment"],91 expected_error_codes=[404, 403])92 def test_delete_segment(self):93 """Delete segment.94 RBAC test for the neutron "delete_segment" policy95 """96 segment = self.create_segment(self.network)97 with self.override_role():98 self.ntp_client.delete_segment(segment['segment']['id'])99 @decorators.idempotent_id('d68a0578-36ae-435e-8aaa-508ee96bdfae')...
test_segment.py
Source:test_segment.py
...21 end_point=Point.objects.filter(name="Czarny staw")[0])22 segment.save()23 self.ex_segment = segment24 def test_incorrect_length_update(self):25 response = SegmentView.update_segment(self.segment, -1, 1, 1, 1, 1, "test", "test")26 self.assertEqual(response, "NieprawidÅowa dÅugoÅÄ")27 self.assertEqual(self.segment[0], DefinedSegment.objects.get(name="test"))28 def test_incorrect_points_update(self):29 response = SegmentView.update_segment(self.segment, 1, 1, 1, 1, -1, "test", "test")30 self.assertEqual(response, "NieprawidÅowa liczba punktów")31 self.assertEqual(self.segment[0], DefinedSegment.objects.get(name="test"))32 def test_incorrect_name_length(self):33 response = SegmentView.update_segment(self.segment, 1, 1, 1, 1, 1, "x" * 51, "test")34 self.assertEqual(response, "DÅugoÅÄ nazwy odcinka poza przedziaÅem <1,50>")35 self.assertEqual(self.segment[0], DefinedSegment.objects.get(name="test"))36 response = SegmentView.update_segment(self.segment, 1, 1, 1, 1, 1, "", "test")37 self.assertEqual(response, "DÅugoÅÄ nazwy odcinka poza przedziaÅem <1,50>")38 self.assertEqual(self.segment[0], DefinedSegment.objects.get(name="test"))39 def test_not_unique_name(self):40 response = SegmentView.update_segment(self.segment, 1, 1, 1, 1, 1, "ex_test", "test")41 self.assertEqual(response, "Odcinek o podanej nazwie już istnieje")42 self.assertEqual(self.segment[0], DefinedSegment.objects.get(name="test"))43 def test_correct_update(self):44 response = SegmentView.update_segment(self.segment, 1, 1, 1, 1, 1, "new_test", "new_test")45 self.assertEqual(response, "zaktualizowano")46 self.assertEqual(DefinedSegment.objects.get(name="new_test").name, "new_test")...
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!!