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

Commit

Permalink
change 'get' to 'post' to call data-store
Browse files Browse the repository at this point in the history
  • Loading branch information
sc15zs committed Jul 1, 2024
1 parent cb914b8 commit 6e82e83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion app/main/download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,13 @@ def process_api_response(query_params: dict) -> tuple:


def process_async_download(query_params: dict):
"""Calls data-store for a file download request.
:param query_params: Query parameters for the API request.
"""
request_url = (
Config.DATA_STORE_API_HOST
+ "/trigger_async_download"
+ ("?" + urlencode(query_params, doseq=True) if query_params else "")
)
requests.get(request_url)
requests.post(request_url)
6 changes: 3 additions & 3 deletions tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@


@pytest.fixture
def mocked_async_download(mocker):
return mocker.patch("app.main.download_data.process_async_download", return_value=True)
def mock_get_response_basic_download(flask_test_client, mocker):
mocker.patch("app.main.routes.process_async_download", return_value=True)


def test_download_logging(flask_test_client, caplog, mocked_async_download):
def test_download_logging(flask_test_client, caplog, mock_get_response_basic_download):
flask_test_client.post("/download", data={"file_format": "xlsx"})
log_line = [record for record in caplog.records if hasattr(record, "request_type")]
assert len(log_line) == 1
Expand Down

0 comments on commit 6e82e83

Please sign in to comment.