refactor: address code review feedback - clean up test imports and add MAIL_PORT validation
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -62,7 +62,10 @@ class Config:
|
|||||||
DROPBOX_REDIRECT_URI = os.getenv("DROPBOX_REDIRECT_URI", "http://localhost:5000/users/dropbox/callback")
|
DROPBOX_REDIRECT_URI = os.getenv("DROPBOX_REDIRECT_URI", "http://localhost:5000/users/dropbox/callback")
|
||||||
|
|
||||||
MAIL_HOST = os.getenv("MAIL_HOST", "localhost")
|
MAIL_HOST = os.getenv("MAIL_HOST", "localhost")
|
||||||
MAIL_PORT = int(os.getenv("MAIL_PORT", "25"))
|
try:
|
||||||
|
MAIL_PORT = int(os.getenv("MAIL_PORT", "25"))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
MAIL_PORT = 25
|
||||||
MAIL_USE_TLS = os.getenv("MAIL_USE_TLS", "False") == "True"
|
MAIL_USE_TLS = os.getenv("MAIL_USE_TLS", "False") == "True"
|
||||||
MAIL_USE_SSL = os.getenv("MAIL_USE_SSL", "False") == "True"
|
MAIL_USE_SSL = os.getenv("MAIL_USE_SSL", "False") == "True"
|
||||||
MAIL_USERNAME = os.getenv("MAIL_USERNAME", "")
|
MAIL_USERNAME = os.getenv("MAIL_USERNAME", "")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import pytest
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import importlib
|
import importlib
|
||||||
|
import musicround.config
|
||||||
|
|
||||||
|
|
||||||
class TestSecurityConfiguration:
|
class TestSecurityConfiguration:
|
||||||
@@ -17,7 +18,6 @@ class TestSecurityConfiguration:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Force module reload to re-evaluate class-level checks
|
# Force module reload to re-evaluate class-level checks
|
||||||
import musicround.config
|
|
||||||
with pytest.raises(ValueError, match="SECRET_KEY environment variable must be set"):
|
with pytest.raises(ValueError, match="SECRET_KEY environment variable must be set"):
|
||||||
importlib.reload(musicround.config)
|
importlib.reload(musicround.config)
|
||||||
finally:
|
finally:
|
||||||
@@ -36,7 +36,6 @@ class TestSecurityConfiguration:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Force module reload to re-evaluate class-level checks
|
# Force module reload to re-evaluate class-level checks
|
||||||
import musicround.config
|
|
||||||
with pytest.raises(ValueError, match="AUTOMATION_TOKEN environment variable must be set"):
|
with pytest.raises(ValueError, match="AUTOMATION_TOKEN environment variable must be set"):
|
||||||
importlib.reload(musicround.config)
|
importlib.reload(musicround.config)
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Reference in New Issue
Block a user