Add nightly realm reports and observed bot activity explanations
Core tests / core (push) Successful in 59s

This commit is contained in:
Codex
2026-09-22 20:46:02 -04:00
parent 64fb329b2e
commit 9d586f4c44
13 changed files with 183 additions and 6 deletions
+8
View File
@@ -56,6 +56,14 @@ class SpectatorTests(unittest.TestCase):
with patch.object(m.SNAPSHOT,'get',return_value={'state':{'bots':[]}}):
with urllib.request.urlopen(base+'/api/state') as response:
self.assertEqual(json.load(response),{'bots':[]})
with patch.object(m,'local_get',return_value=b'{"reports":[]}') as upstream:
with urllib.request.urlopen(base+'/api/realm-insights') as response:
self.assertEqual(json.load(response),{'reports':[]})
upstream.assert_called_once_with('/api/realm-insights')
with self.assertRaises(urllib.error.HTTPError) as error:
urllib.request.urlopen(urllib.request.Request(base+'/api/realm-insights',method='POST',data=b'{}'))
self.assertEqual(error.exception.code,405)
error.exception.close()
for method in ['POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'TRACE']:
with self.assertRaises(urllib.error.HTTPError) as error:
urllib.request.urlopen(urllib.request.Request(base + '/api/actions', method=method, data=b'{}'))