Created
May 21, 2018 07:07
-
-
Save mattstibbs/c3fc1380f968068cd13df28f3b58e57e to your computer and use it in GitHub Desktop.
Mocking log line test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_log_line_written_ods_code(): | |
u = User('test-username', 'test-password') | |
client = RestApiClient(u) | |
identifier = 'A91547' | |
data = { | |
'success': | |
{ | |
'serviceCount': 1, | |
'services': | |
[ | |
{'id': 'A91547', 'name': 'Test Service', 'endpoints': []} | |
] | |
} | |
} | |
with mock.patch.object(client.s, 'get') as get: | |
mock_response = get.return_value | |
mock_response.json.return_value = data | |
with mock.patch.object(rest_api.logger, 'debug') as log: | |
client.get_single_service(identifier, 'ods') | |
log.assert_any_call(f'get_single_service response id = {identifier}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment