def test_uses_uuid(self): uuid = factory.make_UUID() api = make_api() mock = self.patch(api, "config_resolve_class") get_servers(api, uuid) filters = mock.call_args[0][1] attrib = {"class": "computeItem", "property": "uuid", "value": uuid} self.assertEqual(attrib, filters[0].attrib)
def test_uses_uuid(self): uuid = factory.make_UUID() api = make_api() mock = self.patch(api, 'config_resolve_class') get_servers(api, uuid) filters = mock.call_args[0][1] attrib = {'class': 'computeItem', 'property': 'uuid', 'value': uuid} self.assertEqual(attrib, filters[0].attrib)
def test_returns_result(self): uuid = factory.make_UUID() api = make_api() fake_result = make_fake_result("configResolveClass", "found") self.patch(api, "config_resolve_class").return_value = fake_result result = get_servers(api, uuid) self.assertEqual("found", result[0].tag)
def test_class_id(self): uuid = factory.make_UUID() api = make_api() mock = self.patch(api, "config_resolve_class") get_servers(api, uuid) self.assertThat(mock, MockCalledOnceWith("computeItem", ANY))