forked from expo/troggle
Now 99 tests
This commit is contained in:
@@ -21,6 +21,7 @@ https://docs.djangoproject.com/en/dev/topics/testing/tools/
|
||||
import re
|
||||
import subprocess
|
||||
import unittest
|
||||
from http import HTTPStatus
|
||||
|
||||
from django.test import Client, SimpleTestCase, TestCase
|
||||
|
||||
@@ -99,4 +100,28 @@ class ImportTest(TestCase):
|
||||
for e in expected:
|
||||
self.assertIn(e, messages)
|
||||
for e in not_expected:
|
||||
self.assertNotIn(e, messages)
|
||||
self.assertNotIn(e, messages)
|
||||
|
||||
def test_aliases(self):
|
||||
# Needs another test with test data
|
||||
response = self.client.get(f"/aliases/{TEST_YEAR}")
|
||||
self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||
content = response.content.decode()
|
||||
with open('_test_response.html', 'w') as f:
|
||||
f.write(content)
|
||||
ph = f"'fsmartarse'"
|
||||
phmatch = re.search(ph, content)
|
||||
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'")
|
||||
|
||||
|
||||
def test_people(self):
|
||||
# Needs another test with test data
|
||||
response = self.client.get("/people")
|
||||
self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||
content = response.content.decode()
|
||||
with open('_test_response.html', 'w') as f:
|
||||
f.write(content)
|
||||
ph = f"<td><a href=\"/personexpedition/FredSmartarse/{TEST_YEAR}\">{TEST_YEAR}</a></td>"
|
||||
phmatch = re.search(ph, content)
|
||||
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'")
|
||||
|
||||
Reference in New Issue
Block a user