import from kontor-flask

This commit is contained in:
Thomas Peetz
2025-01-08 22:31:20 +01:00
committed by Thomas Peetz
parent d6410e2584
commit 0d2f27f771
61 changed files with 4296 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
"""This module contains tests for Comic related urls."""
import unittest
from flask import url_for
from . import TestBase
class TestComicsViews(TestBase):
def test_comics_index(self):
"""
Test that comics page is inaccessible without login
and redirects to login page then to comics page
"""
target_url = url_for('comic.list_comics')
redirect_url = url_for('auth.login', next=target_url)
response = self.client.get(target_url)
self.assertEqual(response.status_code, 302)
self.assertRedirects(response, redirect_url)
def test_comics_artist(self):
"""
Test that comics page is inaccessible without login
and redirects to login page then to comics page
"""
target_url = url_for('comic.list_artists')
redirect_url = url_for('auth.login', next=target_url)
response = self.client.get(target_url)
self.assertEqual(response.status_code, 302)
self.assertRedirects(response, redirect_url)
def test_comics_publisher(self):
"""
Test that comics page is inaccessible without login
and redirects to login page then to comics page
"""
target_url = url_for('comic.list_publishers')
redirect_url = url_for('auth.login', next=target_url)
response = self.client.get(target_url)
self.assertEqual(response.status_code, 302)
self.assertRedirects(response, redirect_url)
if __name__ == '__main__':
unittest.main()