Best Python code snippet using tempest_python
test_ironic_driver.py
Source:test_ironic_driver.py
...476 res, {"uuid": create_response["port"]["id"],477 "vlan_id": create_response["port"]["vlan_id"]})478 create.assert_called_once_with(body=expected_call)479class TestIronicDriverDeletePort(TestIronicDriverBase):480 def test_delete_port(self):481 with self._stubs(delete_port=[None]) as (driver, client,482 _, delete):483 driver.delete_port(self.context, "foo")484 delete.assert_called_once_with("foo")485 def test_delete_port_retries(self):486 delete_port = [Exception("uhoh"), None]487 with self._stubs(delete_port=delete_port) as (driver,488 client, _,489 delete):490 driver.delete_port(self.context, "foo")491 self.assertEqual(delete.call_count, 2)492 self.assertEqual(493 delete.call_args_list,494 [mock.call("foo"), mock.call("foo")])495 def test_delete_port_fail_does_not_raise(self):496 delete_port = [Exception("uhoh"),497 Exception("uhoh"),498 Exception("uhoh")]499 with self._stubs(delete_port=delete_port) as (driver,500 client, _,501 delete):502 driver.delete_port(self.context, "foo")503 self.assertEqual(delete.call_count, 3)504 self.assertEqual(505 delete.call_args_list,506 [mock.call("foo"), mock.call("foo"),507 mock.call("foo")])508 def test_delete_port_ignores_404(self):509 delete_port = [Exception("404 not found"), None]510 with self._stubs(delete_port=delete_port) as (driver,511 client, _,512 delete):513 driver.delete_port(self.context, "foo")514 delete.assert_called_once_with("foo")515class TestIronicDriverUpdatePort(TestIronicDriverBase):516 def test_update_does_nothing(self):517 with self._stubs() as (driver, client,518 _, delete):519 res = driver.update_port(self.context, "foo", **{})520 client.update_port.assert_not_called()521 self.assertEqual(res, {"uuid": "foo"})522 def test_update_with_sg_raises(self):523 with self._stubs() as (driver, client,524 _, delete):525 self.assertRaises(526 quark.drivers.ironic_driver.IronicException,527 driver.update_port,...
l2_agent_extensions_manager.py
Source:l2_agent_extensions_manager.py
...34 _LE("Agent Extension '%(name)s' does not "35 "implement method handle_port"),36 {'name': extension.name}37 )38 def delete_port(self, context, data):39 """Notify all agent extensions to delete port."""40 for extension in self:41 if hasattr(extension.obj, 'delete_port'):42 extension.obj.delete_port(context, data)43 else:44 LOG.error(45 _LE("Agent Extension '%(name)s' does not "46 "implement method delete_port"),47 {'name': extension.name}...
delete_port.py
Source:delete_port.py
...28 def run(self, result):29 """execute the test"""30 if not self.setup_done:31 self.setup()32 status = self.neutron_client.delete_port(self.port_id)33 if status:34 result.update({"delete_port": 1})35 LOG.info("Delete Port successful!")36 else:37 result.update({"delete_port": 0})...
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!!