mock_remote_object() allows its content to be bytes or string

2019-08-17
Marnanel Thurman 2019-05-29 11:18:10 +01:00
rodzic 03b9262402
commit 243e1d9ca0
1 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -86,12 +86,18 @@ def mock_remote_object(
'Content-Type': 'application/activity+json',
}
if isinstance(content, bytes):
body = content
else:
body = bytes(content, encoding='UTF-8')
httpretty.register_uri(
httpretty.GET,
url,
status=status,
headers=headers,
body=bytes(content, encoding='UTF-8'))
body = body,
)
logger.debug('Mocking %s as %d: %s',
url,