2019-08-02 13:33:38 +00:00
|
|
|
# -*- mode: python; coding: utf-8 -*-
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2019-08-08 10:16:40 +00:00
|
|
|
from users.models import User
|
2019-08-02 13:33:38 +00:00
|
|
|
from django.test import TestCase
|
|
|
|
|
|
|
|
"""
|
|
|
|
Test that every themed page still works
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class TemplateLoggedOutTests(TestCase):
|
|
|
|
def test_login_page(self):
|
2019-08-10 08:44:17 +00:00
|
|
|
response = self.client.get('/database/login/')
|
2019-08-02 13:33:38 +00:00
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
|
|
|
|
|
|
|
class TemplateLoggedInTests(TestCase):
|
|
|
|
def setUp(self):
|
|
|
|
self.user = User.objects.create_superuser(
|
|
|
|
username="admin",
|
|
|
|
password="adminadmin",
|
|
|
|
email="admin@example.com",
|
|
|
|
)
|
|
|
|
self.client.force_login(self.user)
|
|
|
|
|
|
|
|
def test_login_page(self):
|
|
|
|
"""
|
|
|
|
Login page should redirect
|
|
|
|
"""
|
2019-08-10 08:44:17 +00:00
|
|
|
response = self.client.get('/database/login/')
|
2019-08-02 13:33:38 +00:00
|
|
|
self.assertEqual(response.status_code, 302)
|
|
|
|
|
|
|
|
def test_admin_index(self):
|
2019-08-10 08:44:17 +00:00
|
|
|
response = self.client.get('/database/')
|
2019-08-02 13:33:38 +00:00
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
|
|
|
def test_accounts_password_reset(self):
|
|
|
|
response = self.client.get('/accounts/password_reset/')
|
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
|
|
|
def test_logout_page(self):
|
|
|
|
response = self.client.get('/accounts/logout/')
|
|
|
|
self.assertEqual(response.status_code, 200)
|