import from kontor-flask

This commit is contained in:
Thomas Peetz
2025-01-08 22:31:20 +01:00
parent fc4110b11d
commit 6923b3e5ee
61 changed files with 4296 additions and 0 deletions
+110
View File
@@ -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()