Ejemplo n.º 1
0
    def testGetOwner(self, getStubMock):
        ownerName = 'arbitrary-name'
        stubMock = mock.Mock()
        stubMock.GetOwner.return_value = host_pb2.OwnerGetOwnerResponse(
            owner=host_pb2.Owner(name=ownerName))
        getStubMock.return_value = stubMock

        owner = opencue.api.getOwner(ownerName)

        stubMock.GetOwner.assert_called_with(
            host_pb2.OwnerGetOwnerRequest(name=ownerName), timeout=mock.ANY)
        self.assertEqual(ownerName, owner.name())
Ejemplo n.º 2
0
    def testGetOwner(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.GetOwner.return_value = host_pb2.OwnerGetOwnerResponse(
            owner=host_pb2.Owner(id=TEST_OWNER_ID, name=TEST_OWNER_NAME))
        getStubMock.return_value = stubMock

        owner = opencue.wrappers.owner.Owner()
        response = owner.getOwner(TEST_OWNER_NAME)

        stubMock.GetOwner.assert_called_with(
            host_pb2.OwnerGetOwnerRequest(name=TEST_OWNER_NAME), timeout=mock.ANY)
        self.assertEqual(response.id(), TEST_OWNER_ID)
        self.assertEqual(response.name(), TEST_OWNER_NAME)