2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

Still one test failing when it shouldnt

This commit is contained in:
Philip Sargent 2023-09-01 21:50:03 +03:00
parent 5a7eda0968
commit 34064972e9

View File

@ -65,8 +65,7 @@ class ImportTest(TestCase):
mike = make_person("Michael", "Wideboy", "WB", vfho=True) mike = make_person("Michael", "Wideboy", "WB", vfho=True)
# NOT created Kurt, as the whole point is that he is a guest. # NOT created Kurt, as the whole point is that he is a guest.
def setUp(self): def setUp(self):
lbp.LoadLogbook(self.test_expo)
pass pass
def tearDown(self): def tearDown(self):
@ -76,6 +75,7 @@ class ImportTest(TestCase):
self.assertTrue(self.test_logbook.is_file()) self.assertTrue(self.test_logbook.is_file())
def test_logbook_parse(self): def test_logbook_parse(self):
lbp.LoadLogbook(self.test_expo)
issues = DataIssue.objects.all() issues = DataIssue.objects.all()
messages = [] messages = []
@ -103,16 +103,20 @@ class ImportTest(TestCase):
self.assertNotIn(e, messages) self.assertNotIn(e, messages)
def test_lbe(self): def test_lbe(self):
lbp.LoadLogbook(self.test_expo) lbp.LoadLogbook(self.test_expo)
response = self.client.get(f"/logbookentry/1986-07-27/1986-07-27b") response = self.client.get(f"/logbookentry/1986-07-27/1986-07-27b")
self.assertEqual(response.status_code, HTTPStatus.OK) self.assertEqual(response.status_code, HTTPStatus.OK)
content = response.content.decode() content = response.content.decode()
with open('_test_response.html', 'w') as f: with open('_test_response.html', 'w') as f:
f.write(content) f.write(content)
ph = "Smartarse rig first section of new pitches. Second wave arrives and takes over rigging." expected = [
phmatch = re.search(ph, content) "Logbook CUCC expo-test 1986 123 - 123 Wave 1",
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'") "Smartarse rig first section of new pitches. Second wave arrives and takes over rigging.",
]
for ph in expected:
phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'")
def test_aliases(self): def test_aliases(self):
# Problem: '' empty string appears as valid alias for David Smartarse # Problem: '' empty string appears as valid alias for David Smartarse
@ -135,7 +139,6 @@ class ImportTest(TestCase):
ph = f"Caves with subdirectories" ph = f"Caves with subdirectories"
phmatch = re.search(ph, content) phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'") self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'")
def test_people(self): def test_people(self):
# Needs another test with test data # Needs another test with test data