def test_get_missing_dhcp_service(self): """Fetch missing DHCP service; return empty list.""" dhcp_server = 'testgetmissing.dhcp.service.local' dhcp = SpokeDHCPService() result = dhcp.get(dhcp_server)['data'] expected_result = [] self.assertEqual(result, expected_result)
def test_get_missing_dhcp_service(self): """Fetch missing DHCP service; return empty list.""" dhcp_server = "testgetmissing.dhcp.service.local" dhcp = SpokeDHCPService() result = dhcp.get(dhcp_server)["data"] expected_result = [] self.assertEqual(result, expected_result)
def service_search(service): try: from spoke.lib.dhcp import SpokeDHCPService service = SpokeDHCPService() result = service.get(service) except error.SpokeError as e: result = common.handle_error(e) return result
def test_get_dhcp_service(self): """Fetch DHCP service; return DHCP service objects.""" dhcp_server = 'testget.dhcp.service.local' dhcp = SpokeDHCPService() dhcp.create(dhcp_server) result = dhcp.get(dhcp_server)['data'] service_name = dhcp_server + self.dhcp_conf_suffix dn = 'cn=%s,%s' % (service_name, self.base_dn) primary_dn = 'cn=%s,%s' % (dhcp_server, self.base_dn) dn_info = {'objectClass': ['top', self.dhcp_service_class, self.dhcp_options_class], 'cn': [service_name], 'dhcpPrimaryDN': [primary_dn]} expected_result = [(dn, dn_info)] self.assertEqual(result, expected_result) dhcp.delete(dhcp_server)
def test_get_dhcp_service(self): """Fetch DHCP service; return DHCP service objects.""" dhcp_server = "testget.dhcp.service.local" dhcp = SpokeDHCPService() dhcp.create(dhcp_server) result = dhcp.get(dhcp_server)["data"] service_name = dhcp_server + self.dhcp_conf_suffix dn = "cn=%s,%s" % (service_name, self.base_dn) primary_dn = "cn=%s,%s" % (dhcp_server, self.base_dn) dn_info = { "objectClass": ["top", self.dhcp_service_class, self.dhcp_options_class], "cn": [service_name], "dhcpPrimaryDN": [primary_dn], } expected_result = [(dn, dn_info)] self.assertEqual(result, expected_result) dhcp.delete(dhcp_server)
def test_get_dhcp_service(self): """Fetch DHCP service; return DHCP service objects.""" dhcp_server = 'testget.dhcp.service.local' dhcp = SpokeDHCPService() dhcp.create(dhcp_server) result = dhcp.get(dhcp_server)['data'] service_name = dhcp_server + self.dhcp_conf_suffix dn = 'cn=%s,%s' % (service_name, self.base_dn) primary_dn = 'cn=%s,%s' % (dhcp_server, self.base_dn) dn_info = { 'objectClass': ['top', self.dhcp_service_class, self.dhcp_options_class], 'cn': [service_name], 'dhcpPrimaryDN': [primary_dn] } expected_result = [(dn, dn_info)] self.assertEqual(result, expected_result) dhcp.delete(dhcp_server)