Skip to content

Commit

Permalink
Rename routine task tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain-S committed Nov 27, 2023
1 parent 1963b63 commit 326625d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
6 changes: 3 additions & 3 deletions rctab/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

from rctab.constants import ADMIN_OID
from rctab.crud.models import database
from rctab.daily_routine_tasks import (
from rctab.logutils import CustomDimensionsFilter
from rctab.routers.accounting.abolishment import abolish_subscriptions
from rctab.routers.accounting.summary_emails import (
get_timestamp_last_summary_email,
send_summary_email,
)
from rctab.logutils import CustomDimensionsFilter
from rctab.routers.accounting.abolishment import abolish_subscriptions
from rctab.settings import get_settings

my_logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

from rctab.constants import EMAIL_TYPE_SUMMARY
from rctab.crud.accounting_models import emails, failed_emails, subscription
from rctab.daily_routine_tasks import (
from rctab.routers.accounting.send_emails import MissingEmailParamsError
from rctab.routers.accounting.summary_emails import (
get_timestamp_last_summary_email,
send_summary_email,
)
from rctab.routers.accounting.send_emails import MissingEmailParamsError
from tests.test_routes import constants
from tests.test_routes.test_routes import ( # pylint: disable=unused-import # noqa
create_subscription,
Expand Down Expand Up @@ -60,11 +60,15 @@ async def test_send_summary_email(
# pylint: disable=unused-argument
mock_prepare = AsyncMock()
mock_prepare.return_value = {"mock new subs": "return_value"}
mocker.patch("rctab.daily_routine_tasks.prepare_summary_email", mock_prepare)
mocker.patch(
"rctab.routers.accounting.summary_emails.prepare_summary_email", mock_prepare
)

email_recipients = ["[email protected]"]

mock_send = mocker.patch("rctab.daily_routine_tasks.send_with_sendgrid")
mock_send = mocker.patch(
"rctab.routers.accounting.summary_emails.send_with_sendgrid"
)

await send_summary_email(email_recipients)

Expand All @@ -84,9 +88,13 @@ async def test_send_summary_email_missing_params(
# pylint: disable=unused-argument
mock_prepare = AsyncMock()
mock_prepare.return_value = {"mock new subs": "return_value"}
mocker.patch("rctab.daily_routine_tasks.prepare_summary_email", mock_prepare)
mocker.patch(
"rctab.routers.accounting.summary_emails.prepare_summary_email", mock_prepare
)

mock_send = mocker.patch("rctab.daily_routine_tasks.send_with_sendgrid")
mock_send = mocker.patch(
"rctab.routers.accounting.summary_emails.send_with_sendgrid"
)
email_recipients = ["[email protected]", "[email protected]"]
mock_send.side_effect = MissingEmailParamsError(
subject="the_subject",
Expand Down

0 comments on commit 326625d

Please sign in to comment.