1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2012-2023 by the Free Software Foundation, Inc.
4 # This file is part of Postorius.
6 # Postorius is free software: you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free
8 # Software Foundation, either version 3 of the License, or (at your option)
10 # Postorius 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
15 # You should have received a copy of the GNU General Public License along with
16 # Postorius. If not, see <http://www.gnu.org/licenses/>.
19 from django
.test
import TestCase
21 from postorius
.forms
import MemberForm
24 class TestMemberForm(TestCase
):
25 def test_form_labels(self
):
27 self
.assertTrue('email' in form
.fields
.keys())
28 self
.assertEqual(form
.fields
['email'].label
, 'Email Address')
29 self
.assertTrue('display_name' in form
.fields
.keys())
30 self
.assertEqual(form
.fields
['display_name'].label
, 'Display Name')
32 def test_form_errors(self
):
34 self
.assertFalse(form
.is_valid())
36 form
.errors
['email'][0], 'Please enter an email address.'
38 form
= MemberForm({'email': 'invalid.example.com'})
39 self
.assertFalse(form
.is_valid())
41 form
.errors
['email'][0], 'Please enter a valid email address.'