import from kontor-flask
This commit is contained in:
committed by
Thomas Peetz
parent
d6410e2584
commit
0d2f27f771
@@ -0,0 +1,110 @@
|
||||
"""This module contains tests for TradeYourSportsCards related urls."""
|
||||
import unittest
|
||||
from flask import url_for
|
||||
from . import TestBase
|
||||
|
||||
|
||||
class TestTYSCViews(TestBase):
|
||||
|
||||
def test_tysc_index(self):
|
||||
"""
|
||||
Test that TYSC page is inaccessible without login
|
||||
and redirects to login page then to TYSC page
|
||||
"""
|
||||
target_url = url_for('tysc.list_cards')
|
||||
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_tysc_sport(self):
|
||||
"""
|
||||
Test that TYSC page is inaccessible without login
|
||||
and redirects to login page then to TYSC page
|
||||
"""
|
||||
target_url = url_for('tysc.list_sports')
|
||||
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_tysc_team(self):
|
||||
"""
|
||||
Test that TYSC page is inaccessible without login
|
||||
and redirects to login page then to TYSC page
|
||||
"""
|
||||
target_url = url_for('tysc.list_teams')
|
||||
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_tysc_player(self):
|
||||
"""
|
||||
Test that TYSC page is inaccessible without login
|
||||
and redirects to login page then to TYSC page
|
||||
"""
|
||||
target_url = url_for('tysc.list_players')
|
||||
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_tysc_manufacturer(self):
|
||||
"""
|
||||
Test that TYSC page is inaccessible without login
|
||||
and redirects to login page then to TYSC page
|
||||
"""
|
||||
target_url = url_for('tysc.list_manufacturers')
|
||||
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_tysc_card_set(self):
|
||||
"""
|
||||
Test that TYSC page is inaccessible without login
|
||||
and redirects to login page then to TYSC page
|
||||
"""
|
||||
target_url = url_for('tysc.list_card_sets')
|
||||
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_tysc_parallel_set(self):
|
||||
"""
|
||||
Test that TYSC page is inaccessible without login
|
||||
and redirects to login page then to TYSC page
|
||||
"""
|
||||
target_url = url_for('tysc.list_parallel_sets')
|
||||
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_tysc_insert_set(self):
|
||||
"""
|
||||
Test that TYSC page is inaccessible without login
|
||||
and redirects to login page then to TYSC page
|
||||
"""
|
||||
target_url = url_for('tysc.list_insert_sets')
|
||||
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_tysc_card(self):
|
||||
"""
|
||||
Test that TYSC page is inaccessible without login
|
||||
and redirects to login page then to TYSC page
|
||||
"""
|
||||
target_url = url_for('tysc.list_cards')
|
||||
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