RFCartography/tests/test_routing.py

35 lines
1.3 KiB
Python
Raw Permalink Normal View History

2023-01-03 14:42:54 +01:00
from unittest import TestCase
from flask import Flask
from rfcartography import create_app
class TestDetailsPages(TestCase):
def setUp(self):
"""create an app object for testing purposes"""
self.app:Flask = create_app()
self.app.config.update({'TESTING': True})
return
def test_imprint(self):
"""testing the imprint page"""
client: FlaskClient = self.app.test_client()
if 'IMPRINT' in self.app.config:
self.app.config.pop('IMPRINT')
response: TestResponse = client.get('/imprint')
self.assertEqual(response.status, '404 NOT FOUND')
self.app.config.update({'IMPRINT': [('Imprint', '123 test 123 test')]})
response: TestResponse = client.get('/imprint')
self.assertEqual(response.status, '200 OK')
return
def test_privacy(self):
"""testing the privacy page"""
client: FlaskClient = self.app.test_client()
if 'PRIVACY' in self.app.config:
self.app.config.pop('PRIVACY')
response: TestResponse = client.get('/privacy')
self.assertEqual(response.status, '404 NOT FOUND')
self.app.config.update({'PRIVACY': [('Piracy Statement', 'Arrr')]})
response: TestResponse = client.get('/privacy')
self.assertEqual(response.status, '200 OK')
return