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
.contrib
.auth
.models
import User
20 from django
.test
import TestCase
21 from django
.urls
import reverse
23 from allauth
.account
.models
import EmailAddress
25 from postorius
.forms
import DomainForm
28 class DomainViewTest(TestCase
):
30 self
.user
= User
.objects
.create_superuser(
31 'su', 'su@example.com', 'pass'
33 EmailAddress
.objects
.create(
34 user
=self
.user
, email
=self
.user
.email
, verified
=True
40 def test_form_is_rendered(self
):
41 self
.client
.login(username
='su', password
='pass')
42 response
= self
.client
.get(reverse('domain_new'), follow
=True)
43 self
.assertEqual(response
.status_code
, 200)
44 self
.assertIsInstance(response
.context
['form'], DomainForm
)