def testMockCall(self): """Test mock call does not execute any logic, returns success.""" patch = self.PatchObject(paygen_payload_lib, 'PaygenPayload') res = payload.GeneratePayload(self.req, self.result, self.mock_call_config) patch.assert_not_called() self.assertEqual(controller.RETURN_CODE_SUCCESS, res)
def testMockError(self): """Test mock error call does not execute any logic, returns error.""" patch = self.PatchObject(paygen_payload_lib, 'PaygenPayload') res = payload.GeneratePayload(self.req, self.result, self.mock_error_config) patch.assert_not_called() self.assertEqual(controller.RETURN_CODE_COMPLETED_UNSUCCESSFULLY, res)
def testCallSucceeds(self): """Check that a call is made succesfully.""" # Deep patch the paygen lib, this is a full run through service as well. self.PatchObject(paygen_payload_lib, 'PaygenPayload') res = payload.GeneratePayload(self.req, self.result, self.api_config) self.assertEqual(res, controller.RETURN_CODE_SUCCESS)
def testValidateOnly(self): """Sanity check that a validate only call does not execute any logic.""" res = payload.GeneratePayload(self.req, self.result, self.validate_only_config) self.assertEqual(res, controller.RETURN_CODE_VALID_INPUT)