summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-10-05 15:33:01 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-10-05 15:33:01 +0300
commit207513b8b5a641d94123fa48013f9e3b6aff24a9 (patch)
tree8898e93065b022476ced3709db25aa34b8cb27df /core
parented993761a17841bb9295b5a468c9c5716ba4ffb2 (diff)
downloadtroggle-207513b8b5a641d94123fa48013f9e3b6aff24a9.tar.gz
troggle-207513b8b5a641d94123fa48013f9e3b6aff24a9.tar.bz2
troggle-207513b8b5a641d94123fa48013f9e3b6aff24a9.zip
tests now work again
Diffstat (limited to 'core')
-rw-r--r--core/TESTS/test_caves.py6
-rw-r--r--core/TESTS/test_parsers.py7
-rw-r--r--core/fixtures/expo_exped.json7
-rw-r--r--core/models/troggle.py3
4 files changed, 12 insertions, 11 deletions
diff --git a/core/TESTS/test_caves.py b/core/TESTS/test_caves.py
index 42b0924..26bd0cc 100644
--- a/core/TESTS/test_caves.py
+++ b/core/TESTS/test_caves.py
@@ -61,7 +61,7 @@ class FixtureTests(TestCase):
self.assertIsNotNone(phmatch, "In fixture-loaded cave, failed to find expected text: '" + ph + "'")
def test_page_personexpedition(self):
- response = self.client.get("/personexpedition/MichaelSargent/2019")
+ response = self.client.get("/personexpedition/michael-sargent/2019")
content = response.content.decode()
# with open('testresponse.html','w') as tr:
# tr.writelines(content)
@@ -110,7 +110,7 @@ class FixturePageTests(TestCase):
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'")
def test_fix_personexped(self):
- response = self.client.get("/personexpedition/MichaelSargent/2019")
+ response = self.client.get("/personexpedition/michael-sargent/2019")
self.assertEqual(response.status_code, HTTPStatus.OK)
ph = r"Table of all trips and surveys aligned by date"
@@ -122,7 +122,7 @@ class FixturePageTests(TestCase):
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph + "'")
def test_fix_person(self):
- response = self.client.get("/person/MichaelSargent")
+ response = self.client.get("/person/michael-sargent")
self.assertEqual(response.status_code, HTTPStatus.OK)
ph = r"second-generation expo caver "
diff --git a/core/TESTS/test_parsers.py b/core/TESTS/test_parsers.py
index 21f79c7..1fd46b0 100644
--- a/core/TESTS/test_parsers.py
+++ b/core/TESTS/test_parsers.py
@@ -37,14 +37,15 @@ class ImportTest(TestCase):
@classmethod
def setUpTestData(cls):
- def make_person(firstname, lastname, nickname=False, vfho=False, guest=False):
+ def make_person(firstname, lastname, nickname=False, vfho=False):
fullname = f"{firstname} {lastname}"
- coUniqueAttribs = {"first_name": firstname, "last_name": (lastname or "")}
+ slug=f"{firstname.lower()}-{lastname.lower()}"
+ coUniqueAttribs = {"first_name": firstname, "last_name": (lastname or ""), "slug": slug,}
otherAttribs = {"is_vfho": vfho, "fullname": fullname, "nickname": nickname}
person = Person.objects.create(**otherAttribs, **coUniqueAttribs)
coUniqueAttribs = {"person": person, "expedition": cls.test_expo}
- otherAttribs = {"is_guest": guest}
+ otherAttribs = {}
pe = PersonExpedition.objects.create(**otherAttribs, **coUniqueAttribs)
return person
diff --git a/core/fixtures/expo_exped.json b/core/fixtures/expo_exped.json
index ef2f8cd..c98eade 100644
--- a/core/fixtures/expo_exped.json
+++ b/core/fixtures/expo_exped.json
@@ -5,13 +5,14 @@
{"model": "core.personexpedition", "pk": 681, "fields":
{"new_since_parsing": false, "non_public": false,
"expedition": 44,
- "person": 250, "slugfield": null, "is_guest": false
+ "person": 250, "slugfield": null
}},
{"model": "core.person", "pk": 250, "fields":
{"new_since_parsing": false, "non_public": false,
"first_name": "Michael",
- "last_name": "Sargent",
- "fullname": "Michael Sargent", "is_vfho": false, "mug_shot": null,
+ "last_name": "Sargent",
+ "slug": "michael-sargent",
+ "fullname": "Michael Sargent", "is_vfho": false, "is_guest": false, "mug_shot": null,
"blurb": "\n\n\n\n\n\n<p><img class=\"onleft\" src=\"/folk/i/mikey0.jpg\">\n<img class=\"onright\" src=\"/folk/i/mikey1.jpg\" height=\"400\"\nalt=\"\" />\n<b>Michael Sargent</b> CUCC<br />\nExpeditions 2014, 15, 16, 17, 18, 19.\n<p>The first second-generation expo caver in 2014, later members of this exclusive group were Dan Lenartowicz and Sarah Connolly.\n\n\n<img class=\"onleft\" src=\"/folk/i/michaelsargent.jpg\">\n<im\n\n<hr style=\"clear: both\" /><p class=\"caption\">Pre-expo (pre-student) photos from President's Invite (OUCC) \nand first abseiling instruction (Cambridge).</p>\n", "orderref": ""}}
] \ No newline at end of file
diff --git a/core/models/troggle.py b/core/models/troggle.py
index 9175eb6..84d15f6 100644
--- a/core/models/troggle.py
+++ b/core/models/troggle.py
@@ -117,8 +117,7 @@ class Person(TroggleModel):
max_expo_val = int(max_expo_year["year__max"]) + 1
for personexpedition in self.personexpedition_set.all():
- if not personexpedition.is_guest:
- notability += Decimal(1) / (max_expo_val - int(personexpedition.expedition.year))
+ notability += Decimal(1) / (max_expo_val - int(personexpedition.expedition.year))
return notability
def bisnotable(self):