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
0130c063
Verified
Commit
0130c063
authored
Apr 02, 2020
by
Baptiste Beauplat
Browse files
Test Email class to expose uncatched exceptions
parent
c898c19c
Changes
1
Hide whitespace changes
Inline
Side-by-side
debexpo/tests/test_email.py
0 → 100644
View file @
0130c063
# -*- coding: utf-8 -*-
#
# test_email.py - unit tests for Email
#
# This file is part of debexpo
# https://salsa.debian.org/mentors.debian.net-team/debexpo
#
# Copyright © 2020 Baptiste BEAUPLAT <lyknode@cilg.org>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
__author__
=
'Baptiste BEAUPLAT'
__copyright__
=
'Copyright © 2020 Baptiste BEAUPLAT'
__license__
=
'MIT'
import
pylons.test
from
debexpo.lib.email
import
Email
from
debexpo.tests
import
TestController
class
TestEmail
(
TestController
):
def
setUp
(
self
):
self
.
_setup_models
()
app_config
=
pylons
.
test
.
pylonsapp
.
config
self
.
testsmtp
=
app_config
[
'debexpo.testsmtp'
]
def
tearDown
(
self
):
pylons
.
test
.
pylonsapp
.
config
[
'debexpo.testsmtp'
]
=
self
.
testsmtp
def
test_unreachable_smtp
(
self
):
pylons
.
test
.
pylonsapp
.
config
.
pop
(
'debexpo.testsmtp'
)
email
=
Email
(
'importer_fail_admin'
)
self
.
assertEquals
(
email
.
send
([
'user@example.org'
],
message
=
''
),
False
)
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