def testGetDefault(self, stubMock): service1 = 'service1' service2 = 'service2' stubMock.GetDefaultServices.return_value = service_pb2.ServiceGetDefaultServicesResponse( services=service_pb2.ServiceSeq( services=[service_pb2.Service(name=service1), service_pb2.Service(name=service2)])) services = opencue.api.getDefaultServices() stubMock.GetDefaultServices.assert_called_with( service_pb2.ServiceGetDefaultServicesRequest(), timeout=mock.ANY) self.assertEqual([service1, service2], [service.name() for service in services])
def testGetDefaultServices(self, getStubMock): stubMock = mock.Mock() stubMock.GetDefaultServices.return_value = service_pb2.ServiceGetDefaultServicesResponse( services=service_pb2.ServiceSeq( services=[service_pb2.Service(name=TEST_SERVICE_NAME)])) getStubMock.return_value = stubMock wrapper = opencue.wrappers.service.Service() services = wrapper.getDefaultServices() stubMock.GetDefaultServices.assert_called_with( service_pb2.ServiceGetDefaultServicesRequest(), timeout=mock.ANY) self.assertEqual(len(services), 1) self.assertEqual(services[0].name(), TEST_SERVICE_NAME)