Bump copyright year
[mailman-postorious.git] / src / postorius / tests / mailman_api_tests / test_system.py
blobd33d38950768ec255f112ca349d7a30c8844f900
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2018-2022 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)
9 # any later version.
11 # Postorius is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 # more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Postorius. If not, see <http://www.gnu.org/licenses/>.
20 from django.contrib.auth.models import User
21 from django.urls import reverse
23 from allauth.account.models import EmailAddress
25 from postorius.tests.utils import ViewTestCase
28 class TestSystemInformationPage(ViewTestCase):
30 def setUp(self):
31 super().setUp()
32 self.superuser = User.objects.create_superuser(
33 'testsu', 'su@example.com', 'testpass')
34 EmailAddress.objects.create(
35 user=self.superuser, email='su@example.com', verified=True)
37 def test_system_info(self):
38 response = self.client.get(reverse('system_information'))
39 # Logged-out users shouldn't be able to get this information.
40 self.assertEqual(response.status_code, 302)
41 # Superuser should have access to this information.
42 self.assertTrue(self.client.login(
43 username='testsu', password='testpass'))
44 response = self.client.get(reverse('system_information'))
45 self.assertEqual(response.status_code, 200)
46 self.assertIn(b'Mailman Core API Version', response.content)
47 self.assertIn(b'Mailman Core Version', response.content)