def test__log_request_Should_CallLogger_When_JsonNotSerializable( self, logger_patch, redact_patch, *patches): redact_patch.return_value = '--redacted-arguments--' client = RESTclient('hostname1.company.com', bearer_token='token') arguments = {'address': '--address--', 'data': Mock()} client.log_request('GET', arguments, True) debug_call = call( '\nGET: --address-- NOOP: True\n"--redacted-arguments--"') self.assertTrue(debug_call in logger_patch.debug.mock_calls)
def test__log_request_Should_CallLogger_When_JsonSerializable( self, logger_patch, redact_patch, *patches): arguments = {'address': '--address--', 'data': 'data'} redact_patch.return_value = arguments client = RESTclient('hostname1.company.com', bearer_token='token') client.log_request('GET', arguments, True) debug_call = call( '\nGET: --address-- NOOP: True\n{\n "address": "--address--",\n "data": "data"\n}' ) self.assertTrue(debug_call in logger_patch.debug.mock_calls)