Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: match default timeout to benefits #328

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eligibility_server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
DEBUG_MODE = True
HOST = "0.0.0.0" # nosec
LOG_LEVEL = "INFO"
REQUEST_TIMEOUT = 5
REQUEST_TIMEOUT = (3, 20)

# Database settings

Expand Down Expand Up @@ -65,7 +65,7 @@ def log_level(self):

@property
def request_timeout(self):
return int(current_app.config["REQUEST_TIMEOUT"])
return current_app.config["REQUEST_TIMEOUT"]

# API settings

Expand Down
3 changes: 2 additions & 1 deletion tests/test_keypair.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from eligibility_server import keypair
from eligibility_server.keypair import _read_key_file
from eligibility_server.settings import REQUEST_TIMEOUT


@pytest.fixture
Expand Down Expand Up @@ -50,7 +51,7 @@ def test_read_key_file_remote(sample_key_path_remote, spy_open, spy_requests_get
# check that there was no call to open
assert spy_open.call_count == 0
# check that we made a get request
spy_requests_get.assert_called_once_with(sample_key_path_remote, timeout=5)
spy_requests_get.assert_called_once_with(sample_key_path_remote, timeout=REQUEST_TIMEOUT)
assert key
assert key == requests.get(sample_key_path_remote, timeout=5).text.encode("utf8")

Expand Down