~abompard/mailman/pgsql_upgrade

« back to all changes in this revision

Viewing changes to src/mailman/model/tests/test_address.py

  • Committer: Barry Warsaw
  • Date: 2014-04-15 03:12:01 UTC
  • mfrom: (7240.1.1 floaddr)
  • Revision ID: barry@list.org-20140415031201-td1fuuyvptco2pqy
 * Addresses can be added to existing users, including display names, via the
   REST API.  [Florian Fuchs]

Also, email addresses are validated when they are added via the IUserManager
interface.  They are still also validated when subscribing to a mailing list,
but that is redundant.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2011-2014 by the Free Software Foundation, Inc.
 
2
#
 
3
# This file is part of GNU Mailman.
 
4
#
 
5
# GNU Mailman is free software: you can redistribute it and/or modify it under
 
6
# the terms of the GNU General Public License as published by the Free
 
7
# Software Foundation, either version 3 of the License, or (at your option)
 
8
# any later version.
 
9
#
 
10
# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
 
11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
13
# more details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License along with
 
16
# GNU Mailman.  If not, see <http://www.gnu.org/licenses/>.
 
17
 
 
18
"""Test addresses."""
 
19
 
 
20
from __future__ import absolute_import, print_function, unicode_literals
 
21
 
 
22
__metaclass__ = type
 
23
__all__ = [
 
24
    'TestAddress',
 
25
    ]
 
26
 
 
27
 
 
28
import unittest
 
29
 
 
30
from mailman.email.validate import InvalidEmailAddressError
 
31
from mailman.model.address import Address
 
32
from mailman.testing.layers import ConfigLayer
 
33
 
 
34
 
 
35
 
 
36
class TestAddress(unittest.TestCase):
 
37
    """Test addresses."""
 
38
 
 
39
    layer = ConfigLayer
 
40
 
 
41
    def test_invalid_email_string_raises_exception(self):
 
42
        with self.assertRaises(InvalidEmailAddressError):
 
43
            Address('not_a_valid_email_string', '')