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

Commit

Permalink
BAU: Fix application-store email date comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
tferns committed Nov 1, 2023
1 parent 61505e8 commit f61fbaa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
8 changes: 2 additions & 6 deletions scripts/send_application_on_closure.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from distutils.util import strtobool


sys.path.insert(1, ".")

import external_services # noqa: E402
Expand Down Expand Up @@ -41,12 +40,9 @@ def send_incomplete_applications_after_deadline(
- application_id (str, required if `single_application` is True): The application_id to process.
"""

current_date_time = (
datetime.now().replace(microsecond=0).strftime("%Y-%m-%d %H:%M:%S")
)

fund_rounds = get_fund_round(fund_id, round_id)
if current_date_time > fund_rounds.get("deadline"):
deadline = datetime.strptime(fund_rounds.get("deadline"), "%Y-%m-%dT%H:%M:%S")
if datetime.now() > deadline:
fund_data = get_fund(fund_id)
search_params = {
"status_only": ["NOT_STARTED", "IN_PROGRESS", "COMPLETED"],
Expand Down
18 changes: 9 additions & 9 deletions tests/test_send_app_on_closure.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_send_apps_bad_account_id(
mocker.patch(
"scripts.send_application_on_closure.get_fund_round",
return_value={
"deadline": "2022-12-01 12:00:00",
"deadline": "2022-12-01T12:00:00",
"round_name": "COF R2W2",
},
)
Expand Down Expand Up @@ -63,7 +63,7 @@ def test_send_apps_no_apps(

mocker.patch(
"scripts.send_application_on_closure.get_fund_round",
return_value={"deadline": "2022-01-01 12:00:00"},
return_value={"deadline": "2022-01-01T12:00:00"},
)

result = send_incomplete_applications_after_deadline(fund_id, round_id, True)
Expand All @@ -76,7 +76,7 @@ def test_send_apps_send_emails_is_false(
):
mocker.patch(
"scripts.send_application_on_closure.get_fund_round",
return_value={"deadline": "2022-01-01 12:00:00"},
return_value={"deadline": "2022-01-01T12:00:00"},
)

result = send_incomplete_applications_after_deadline(
Expand All @@ -98,7 +98,7 @@ def test_send_apps_one_to_send_not_started(
mocker.patch(
"scripts.send_application_on_closure.get_fund_round",
return_value={
"deadline": "2022-12-01 12:00:00",
"deadline": "2022-12-01T12:00:00",
"round_name": "COF R2W2",
},
)
Expand All @@ -121,7 +121,7 @@ def test_send_single_application(
mocker.patch(
"scripts.send_application_on_closure.get_fund_round",
return_value={
"deadline": "2022-12-01 12:00:00",
"deadline": "2022-12-01T12:00:00",
"round_name": "COF R2W2",
},
)
Expand Down Expand Up @@ -152,7 +152,7 @@ def test_send_apps_one_to_send_in_progress(
mocker.patch(
"scripts.send_application_on_closure.get_fund_round",
return_value={
"deadline": "2022-12-01 12:00:00",
"deadline": "2022-12-01T12:00:00",
"round_name": "COF R2W2",
},
)
Expand All @@ -176,7 +176,7 @@ def test_send_apps_two_to_send(
mocker.patch(
"scripts.send_application_on_closure.get_fund_round",
return_value={
"deadline": "2022-12-01 12:00:00",
"deadline": "2022-12-01T12:00:00",
"round_name": "COF R2W2",
},
)
Expand Down Expand Up @@ -210,7 +210,7 @@ def test_send_apps_one_to_send_one_bad_id(
mocker.patch(
"scripts.send_application_on_closure.get_fund_round",
return_value={
"deadline": "2022-12-01 12:00:00",
"deadline": "2022-12-01T12:00:00",
"round_name": "COF R2W2",
},
)
Expand All @@ -234,7 +234,7 @@ def test_send_apps_before_deadline(self, mocker, app, mocked_get_fund):

mocker.patch(
"scripts.send_application_on_closure.get_fund_round",
return_value={"deadline": "2025-01-01 12:00:00"},
return_value={"deadline": "2025-01-01T12:00:00"},
)

result = send_incomplete_applications_after_deadline(fund_id, round_id)
Expand Down

0 comments on commit f61fbaa

Please sign in to comment.