import from kontor-flask
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user