def test_list_dhcp_servers(self, api): api.check_dhcp.return_value = iter([expected_response]) command = cli.main(['discover', '--ifaces', 'eth0', 'eth1', '--format', 'json']) self.assertEqual(command, 0) api.check_dhcp.assert_called_once_with(['eth0', 'eth1'], repeat=2, timeout=5)
def test_list_dhcp_vlans_info(self, api): config_sample = {'eth1': ['100', '101'], 'eth2': range(103, 110)} api.check_dhcp_with_vlans.return_value = iter([expected_response]) command = cli.main(['vlans', json.dumps(config_sample)]) self.assertEqual(command, 0) api.check_dhcp_with_vlans.assert_called_once_with( config_sample, repeat=2, timeout=5)
def test_list_dhcp_assignment(self, api): api.check_dhcp_request.return_value = iter([expected_response]) command = cli.main(['request', 'eth1', '10.20.0.2', '--range_start', '10.20.0.10', '--range_end', '10.20.0.20']) self.assertEqual(command, 0) api.check_dhcp_request.assert_called_once_with( 'eth1', '10.20.0.2', '10.20.0.10', '10.20.0.20', timeout=5 )