Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

Commit

Permalink
test: regression coverage for #109 (timeouts treated as auth errors)
Browse files Browse the repository at this point in the history
  • Loading branch information
redshiftzero authored and sssoleileraaa committed Feb 11, 2020
1 parent 68e25b1 commit b252f71
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_apiproxy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import datetime
import http
import json
import os
import pyotp
import pytest
Expand Down Expand Up @@ -362,3 +364,14 @@ def communicate(self, *nargs, **kwargs) -> None:
with pytest.raises(RequestTimeoutError):
s = Submission(uuid="climateproblem")
api.download_submission(s)


def test_download_get_sources_error_request_timeout(mocker):
api = API("mock", "mock", "mock", "mock", True)
mocker.patch("sdclientapi.json_query",
return_value=(
json.dumps({"body": json.dumps({"error": "wah"}),
"status": http.HTTPStatus.GATEWAY_TIMEOUT,
"headers": "foo"})))
with pytest.raises(RequestTimeoutError):
api.get_sources()

0 comments on commit b252f71

Please sign in to comment.