def testCreateService(self, getStubMock): stubMock = mock.Mock() stubMock.CreateService.return_value = service_pb2.ServiceCreateServiceResponse( service=service_pb2.Service(name=TEST_SERVICE_NAME)) getStubMock.return_value = stubMock wrapper = opencue.wrappers.service.Service( service_pb2.Service(name=TEST_SERVICE_NAME)) service = wrapper.create() stubMock.CreateService.assert_called_with( service_pb2.ServiceCreateServiceRequest(data=wrapper.data), timeout=mock.ANY) self.assertEqual(wrapper.name(), service.name())
def testCreate(self, stubMock): stubMock.CreateService.return_value = service_pb2.ServiceCreateServiceResponse( service=self.service) newService = opencue.api.createService(self.service) stubMock.CreateService.assert_called_with( service_pb2.ServiceCreateServiceRequest(data=self.service), timeout=mock.ANY) self.assertEqual(self.testName, newService.name()) self.assertEqual(self.testTags, newService.tags()) self.assertEqual(self.testThreadable, newService.threadable()) self.assertEqual(self.testMinCores, newService.minCores()) self.assertEqual(self.testMaxCores, newService.maxCores())