Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillatrev committed Dec 21, 2023
1 parent 33388e9 commit 3949ca3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/fixtures/mock_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ def _mock_response(url="", status=200, json_data=None, text=""):
if json_data:
response.json = mocker.Mock(return_value=json_data)
type(response).content = mocker.PropertyMock(
return_value=json.dumps(json_data).encode('utf-8'))
return_value=str(json_data).encode('utf-8'))
return response
return _mock_response
5 changes: 4 additions & 1 deletion tests/test_async_summarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ def test_get_transcript_summary_json_paragraph_as_stream(self, mock_session, mak

summary = client.get_transcript_summary_json_as_stream(JOB_ID)

assert json.loads(summary.content) == data
s = summary.content.decode('utf-8')
s = s.replace('\'', '"')

assert json.loads(s) == data

mock_session.request.assert_called_once_with(
"GET",
Expand Down
4 changes: 3 additions & 1 deletion tests/test_async_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ def test_get_translated_transcript_json_as_stream(self, mock_session, make_mock_
mock_session.request.return_value = response

translation = client.get_translated_transcript_json_as_stream(JOB_ID, "es")
assert json.loads(translation.content) == data
s = translation.content.decode('utf-8')
s = s.replace('\'', '"')
assert json.loads(s) == data
mock_session.request.assert_called_once_with(
"GET",
url,
Expand Down

0 comments on commit 3949ca3

Please sign in to comment.