def test_get_resources_not_found(self):
     for locator in [Locator(vm=VmLocator("1234567")),
                     Locator(disk=DiskLocator("891"))]:
         request = GetResourcesRequest([locator])
         response = rpc_call(self.host_client.get_resources, request)
         assert_that(response.result, is_(GetResourcesResultCode.OK))
         assert_that(response.resources, is_([]))
 def get_vm(self, expect_found=True):
     request = GetResourcesRequest([Locator(vm=VmLocator(self.id))])
     response = rpc_call(self.host_client.get_resources, request)
     assert_that(response.result, equal_to(GetResourcesResultCode.OK))
     if expect_found:
         assert_that(len(response.resources), is_(1))
         return response.resources[0].vm
     else:
         assert_that(len(response.resources), is_(0))
         return None
Ejemplo n.º 3
0
 def find(self, expect=FindResultCode.OK):
     request = FindRequest(Locator(VmLocator(self.id)))
     response = rpc_call(self.host_client.find, request)
     assert_that(response.result, equal_to(expect))
     return response