def test_manual_service(self): dummyCompute = dummy.Compute() foo = TestServiceManual_dummy() dummyCompute.run(foo) self.assertEqual(foo.a, 11) self.assertEqual(foo.b, 22) self.assertEqual(foo.c, 33) self.assertEqual(foo.d, 44)
def setUp(self): # Use registry self.patches.append(mock.patch.dict(base.services, clear=True)) # Use compute self.patches.append( mock.patch.object(terra.compute.utils.ComputeHandler, '_connection', mock.PropertyMock(return_value=dummy.Compute()))) super().setUp() dummy.Compute.register(TestServiceManual)(TestServiceManual_dummy) # Normally you don't register to the base base.BaseCompute.register(TestService)(TestService_base)
def setUp(self): super().setUp() self.dummyCompute = dummy.Compute()
def setUp(self): # self.run calls pre_run which trigger Executor self.patches.append(mock.patch.dict(Executor.__dict__)) super().setUp() self.dummyCompute = dummy.Compute()