Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
6b0194bf
Verified
Commit
6b0194bf
authored
Nov 02, 2021
by
Baptiste Beauplat
Browse files
Add unit test to check bounce address
parent
5d906af5
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/tools/test_email.py
View file @
6b0194bf
...
...
@@ -53,12 +53,19 @@ class TestMail(TestCase):
self
.
email
.
send
(
'My subject'
,
[])
self
.
assertFalse
(
hasattr
(
self
.
email
,
'email'
))
def
_assert_mail_content
(
self
,
content
):
def
_assert_mail_content
(
self
,
content
,
bounce
=
'bounce@example.org'
):
self
.
_assert_base_content
(
content
.
body
)
self
.
assertIn
(
'user@example.org'
,
content
.
to
)
self
.
assertIn
(
'
bounce
@example.org'
,
content
.
from_email
)
self
.
assertIn
(
bounce
,
content
.
from_email
)
self
.
assertIn
(
'From: debexpo <support@example.org>'
,
str
(
content
.
message
()))
def
_assert_base_content
(
self
,
content
):
self
.
assertIn
(
'This is a test email, user@example.org'
,
content
)
def
test_bounce
(
self
):
bounce
=
'another@example.org'
self
.
email
.
send
(
'My subject'
,
[
'user@example.org'
],
bounce_to
=
bounce
)
self
.
_assert_mail_content
(
mail
.
outbox
[
0
],
bounce
=
bounce
)
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment