Skip to content

Commit

Permalink
Ran linting to make actions succeed
Browse files Browse the repository at this point in the history
  • Loading branch information
jcadam14 committed Feb 9, 2024
1 parent 24d42af commit 6a8f432
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
5 changes: 2 additions & 3 deletions regtech_mail_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
def read_root():
return {"message": "Welcome to the Email API"}


# TODO: Remove this once out of initial dev
@app.get("/debug")
async def get_debug_info(request: Request):
Expand Down Expand Up @@ -61,6 +62,4 @@ async def send_email(request: Request):

mailer.send(email)

return {
"email": email
}
return {"email": email}
18 changes: 12 additions & 6 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ class TestEmailApiSettings:
default_smtp_username = SecretStr("tester_1")
default_smtp_password = SecretStr("ABCDEFGHIJKLMNOPQRSTUVWXYZ")


def test_check_smtp_mock_sender(self):
EmailApiSettings(
email_mailer=EmailMailerType.MOCK,
from_addr=self.default_from_addr,
to=self.default_to,
to=self.default_to,
)

def test_check_smtp_no_host(self):
Expand All @@ -28,7 +27,9 @@ def test_check_smtp_no_host(self):
to=self.default_to,
)

assert "SMTP host must be set when using SMTP email sender" in str(excinfo.value)
assert "SMTP host must be set when using SMTP email sender" in str(
excinfo.value
)

def test_check_smtp_with_host(self):
EmailApiSettings(
Expand Down Expand Up @@ -58,8 +59,10 @@ def test_check_smtp_with_creds_no_username(self):
to=self.default_to,
)

assert "username and password must both be set when using SMTP credentials" in str(excinfo.value)

assert (
"username and password must both be set when using SMTP credentials"
in str(excinfo.value)
)

def test_check_smtp_with_creds_no_password(self):
with pytest.raises(ValidationError) as excinfo:
Expand All @@ -70,4 +73,7 @@ def test_check_smtp_with_creds_no_password(self):
from_addr=self.default_from_addr,
to=self.default_to,
)
assert "username and password must both be set when using SMTP credentials" in str(excinfo.value)
assert (
"username and password must both be set when using SMTP credentials"
in str(excinfo.value)
)

0 comments on commit 6a8f432

Please sign in to comment.