Best Python code snippet using tempest_python
test_waiters.py
Source:test_waiters.py
...97 sleep.assert_called_once_with(client.build_interval)98 one_interface = {'interfaceAttachments': [{'port_id': 'port_one'}]}99 two_interfaces = {'interfaceAttachments': [{'port_id': 'port_one'},100 {'port_id': 'port_two'}]}101 def test_wait_for_interface_detach(self):102 list_interfaces = mock.MagicMock(103 side_effect=[self.two_interfaces, self.one_interface])104 client = self.mock_client(list_interfaces=list_interfaces)105 self.patch('time.time', return_value=0.)106 sleep = self.patch('time.sleep')107 result = waiters.wait_for_interface_detach(108 client, 'server_id', 'port_two')109 self.assertIs(self.one_interface['interfaceAttachments'], result)110 list_interfaces.assert_has_calls([mock.call('server_id'),111 mock.call('server_id')])112 sleep.assert_called_once_with(client.build_interval)113 def test_wait_for_interface_detach_timeout(self):114 list_interfaces = mock.MagicMock(return_value=self.one_interface)115 client = self.mock_client(list_interfaces=list_interfaces)116 self.patch('time.time', side_effect=[0., client.build_timeout + 1.])117 sleep = self.patch('time.sleep')118 self.assertRaises(lib_exc.TimeoutException,119 waiters.wait_for_interface_detach,120 client, 'server_id', 'port_one')121 list_interfaces.assert_has_calls([mock.call('server_id'),...
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!!