Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Commits
9dafccf4
Commit
9dafccf4
authored
3 years ago
by
Stein Elgethun
Browse files
Options
Downloads
Patches
Plain Diff
Get instance name from settings when sending mail
Issue: GREG-42
parent
0863921e
No related branches found
Branches containing commit
No related tags found
1 merge request
!83
Greg 42 email
Pipeline
#95864
passed
3 years ago
Stage: venv update
Stage: tests and linting
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gregui/mailutils.py
+2
-1
2 additions, 1 deletion
gregui/mailutils.py
gregui/tests/test_mailutils.py
+3
-3
3 additions, 3 deletions
gregui/tests/test_mailutils.py
with
5 additions
and
4 deletions
gregui/mailutils.py
+
2
−
1
View file @
9dafccf4
from
django.conf
import
settings
from
django.core.mail
import
send_mail
from
django.template.loader
import
render_to_string
...
...
@@ -22,7 +23,7 @@ def confirmation_template(guest) -> str:
def
send_registration_mail
(
mail_to
,
sponsor
)
->
int
:
return
send_mail
(
subject
=
"
Subject
"
,
message
=
registration_template
(
"
UiO
"
,
sponsor
),
message
=
registration_template
(
settings
.
INSTANCE_NAME
,
sponsor
),
from_email
=
None
,
recipient_list
=
[
mail_to
]
)
...
...
This diff is collapsed.
Click to expand it.
gregui/tests/test_mailutils.py
+
3
−
3
View file @
9dafccf4
...
...
@@ -8,14 +8,14 @@ from gregui import mailutils
def
test_registration_template
():
prefilled_template
=
"""
Dette er en automatisk generert melding fra gjestregistreringstjenesten.
Du har blitt registrert som gjest på
UiO
av Foo Bar.
Du har blitt registrert som gjest på
InstanceName
av Foo Bar.
For å fullføre registreringen av gjestekontoen følg denne lenken: www.google.com
This message has been automatically generated by the guest registration system.
You have been registered as a guest at
UiO
by Foo Bar.
You have been registered as a guest at
InstanceName
by Foo Bar.
To complete the registration of your guest account, please follow this link: www.google.com
"""
rendered_template
=
mailutils
.
registration_template
(
"
UiO
"
,
"
Foo Bar
"
)
rendered_template
=
mailutils
.
registration_template
(
"
InstanceName
"
,
"
Foo Bar
"
)
assert
rendered_template
==
prefilled_template
...
...
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