Add sample scenario data and reporting updates

This commit is contained in:
maxwes08 committed 2026-11-04 09:53:53 +01:00
1 parent aa0028e7e0
commit 133bc6ce3f
15 files changed
+444 -238

No files matched your search

+16
View File
@@ -274,6 +274,22 @@ class SeededApi(unittest.TestCase):
if report['periodDays']==7: texts.append(report['executive']['paragraphs'][0]['text'])
self.assertEqual(len(texts),len(set(texts)))
def test_sample_genres_personalities_and_graphable_fields(self):
with connect() as conn:
games=conn.execute("SELECT id,properties FROM games WHERE properties->>'sampleVersion'='3'").fetchall()
self.assertEqual(len({g['properties']['genre'] for g in games}),3)
self.assertEqual({g['properties']['sampleScenario'] for g in games},{'stable','declining','discovery_surge'})
for game in games:
kinds=conn.execute("SELECT DISTINCT metadata->>'simulationGroup' kind FROM players WHERE game_id=%s",(game['id'],)).fetchall()
self.assertEqual(len(kinds),8)
data=dispatch(f"/api/games/{game['id']}/players",{})
self.assertTrue(any(f['key']=='playStyle' for f in data['fields']))
self.assertTrue(all(p['playStyle'] for p in data['playerRows']))
pid=data['playerRows'][0]['playerId']
profile=dispatch(f"/api/games/{game['id']}/players/{pid}",{})
self.assertNotIn('playStyle',{f['key'] for f in profile['historyFields']})
self.assertNotIn('acquisitionSource',{f['key'] for f in profile['historyFields']})
def test_daily_event_lines_match_summary(self):
data=dispatch(f'/api/games/{self.game}/events',{'days':['7']})
self.assertNotIn('events',data)