Skip to content
Snippets Groups Projects
Commit b790109f authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

Add mail config to example config and add test

parent fdba65a7
No related branches found
No related tags found
1 merge request!69Feature/comp 257 send email on signup
...@@ -6,5 +6,13 @@ ...@@ -6,5 +6,13 @@
"client_secret": "<secret>", "client_secret": "<secret>",
"server_metadata_url": "https://accounts.google.com/.well-known/openid-configuration" "server_metadata_url": "https://accounts.google.com/.well-known/openid-configuration"
}, },
"SECRET_KEY": "changeme" "SECRET_KEY": "changeme",
"mail": {
"MAIL_SERVER": "mail.geant.net",
"MAIL_PORT": 25,
"MAIL_SENDER_EMAIL": "compendium@geant.org",
"MAIL_EXCLUDED_ADMINS": [
"bjarke@nordu.net"
]
}
} }
...@@ -26,7 +26,7 @@ def dummy_config(): ...@@ -26,7 +26,7 @@ def dummy_config():
@pytest.fixture @pytest.fixture
def mocked_admin_user(app, mocker): def mocked_admin_user(app, test_survey_data, mocker):
with app.app_context(): with app.app_context():
user = User(email='testemail123@email.local', fullname='testfullname', oidc_sub='fakesub', roles=ROLES.admin) user = User(email='testemail123@email.local', fullname='testfullname', oidc_sub='fakesub', roles=ROLES.admin)
...@@ -42,7 +42,7 @@ def mocked_admin_user(app, mocker): ...@@ -42,7 +42,7 @@ def mocked_admin_user(app, mocker):
@pytest.fixture @pytest.fixture
def mocked_user(app, mocker): def mocked_user(app, test_survey_data, mocker):
with app.app_context(): with app.app_context():
user = User(email='testemail123@email.local', fullname='testfullname', oidc_sub='fakesub') user = User(email='testemail123@email.local', fullname='testfullname', oidc_sub='fakesub')
......
from compendium_v2.email import send_mail
def test_email(app, mocked_admin_user, mocker):
def _send_mail(*args, **kwargs):
pass
mocker.patch('compendium_v2.email._send_mail', _send_mail)
with app.app_context():
app.config['MAIL_ENABLE'] = True
app.config['MAIL_SERVER'] = 'localhost'
app.config['MAIL_PORT'] = 54655
app.config['MAIL_SENDER_EMAIL'] = 'fakesender123@test.local'
app.config['MAIL_EXCLUDED_ADMINS'] = []
send_mail('testmail321')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment