Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compendium-v2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
compendium-v2
Commits
b790109f
Commit
b790109f
authored
1 year ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
Add mail config to example config and add test
parent
fdba65a7
No related branches found
No related tags found
1 merge request
!69
Feature/comp 257 send email on signup
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config-example.json
+9
-1
9 additions, 1 deletion
config-example.json
test/conftest.py
+2
-2
2 additions, 2 deletions
test/conftest.py
test/test_send_mail.py
+16
-0
16 additions, 0 deletions
test/test_send_mail.py
with
27 additions
and
3 deletions
config-example.json
+
9
−
1
View file @
b790109f
...
@@ -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"
]
}
}
}
This diff is collapsed.
Click to expand it.
test/conftest.py
+
2
−
2
View file @
b790109f
...
@@ -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
'
)
...
...
This diff is collapsed.
Click to expand it.
test/test_send_mail.py
0 → 100644
+
16
−
0
View file @
b790109f
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
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment