Best Python code snippet using tempest_python
test_delete_endpoint.py
Source:test_delete_endpoint.py
...13from test.trn_controller.common import cidr14from test.trn_func_tests.helper import *15import unittest16from time import sleep17class test_delete_endpoint(unittest.TestCase):18 def setUp(self):19 # Testing the following basic scenario20 #21 # +------------+ +------------+22 # | Left | | Right |23 # | +--------+ | | +--------+ |24 # | | ns0 | | | | ns1 | |25 # | | | | | | | |26 # | +--------+ | | +--------+ |27 # | | veth0 | | | | veth0 | |28 # | |10.0.0.1| | | |10.0.0.2| |29 # | +--------+ | | +--------+ |30 # | | | | | |31 # | | | | | |32 # | | | | | |33 # | +--------+ | | +--------+ |34 # | |Transit | | | |Transit | |35 # | | Agent | | | | Agent | |36 # | | peer0 | | | | peer1 | |37 # | +--------+ | | +--------+ |38 # +------------+ +------------+39 # |Transit XDP | |Transit XDP |40 # | eth0 | | eth0 |41 # +------------+ +------------+42 # | |43 # | +------------+ |44 # | | Switch | |45 # | | | |46 # +---+------------+--+47 # |Transit XDP |48 # | eth0 |49 # +------------+50 self.droplets = {51 "left": droplet("left"),52 "right": droplet("right"),53 "switch": droplet("switch"),54 }55 self.c = controller(self.droplets)56 self.c.create_vpc(3, cidr("16", "10.0.0.0"), [])57 self.c.create_network(3, 1, cidr("16", "10.0.0.0"), ["switch"])58 self.ep_right = self.c.create_simple_endpoint(59 3, 1, "10.0.0.3", "right")60 # Clear all droplet update state before we create and delete ep_left61 self.droplets["switch"].clear_update_call_state()62 self.droplets["right"].clear_update_call_state()63 self.ep_left = self.c.create_simple_endpoint(3, 1, "10.0.0.2", "left")64 self.ep_left = self.c.delete_simple_endpoint(3, 1, "10.0.0.2")65 def tearDown(self):66 pass67 def test_delete_endpoint(self):68 logger.info(69 "{} Testing endpoint properly deleted! {}".format('='*20, '='*20))70 do_validate_delete_test(71 self, self.droplets.values())...
tests.py
Source:tests.py
...33 self.assertEquals(response.status_code, 200)34 35 36 @parameterized.expand([obj_id, client])37 def test_delete_endpoint(self, client):38 response = client.delete('http://localhost:8000/%s/', timeout=10) 39 self.assertEquals(response.status_code, 200)40 self.assertLess(len(models.%s.objects.all()), 1)41 42 """ % (model, model.lower(), model, model, model, model)43 )44 assert result_output.stdout.files[-4:-2] == [45 u'test_endpoints.py::test_create_endpoint PASSED',46 u'test_endpoints.py::test_update_endpoint PASSED',47 u'test_endpoints.py::test_delete_endpoint PASSED',...
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!!