Track reopened supply chests and fix API snapshots

This commit is contained in:
Tanner
2026-11-07 17:02:29 +00:00
parent 43b37b76f6
commit 9251edc36a
8 changed files with 280 additions and 7 deletions
+12 -1
View File
@@ -31,7 +31,8 @@ class TestWebInventoryAPI(unittest.TestCase):
def setUp(self):
self.g = mosfet_web.g
self.original = {
key: self.g.get(key) for key in ('connected', 'game', 'inv')
key: self.g.get(key) for key in
('connected', 'game', 'inv', 'chest_viewers')
}
self.game = FakeGame()
self.g.connected = True
@@ -53,6 +54,16 @@ class TestWebInventoryAPI(unittest.TestCase):
item = response.get_json()['inv']['9']
self.assertEqual(item['components']['custom_name']['text'], 'Test Paper')
def test_global_api_stringifies_tuple_keys(self):
self.g.chest_viewers = {(12, 64, -7): 1}
response = self.client.get('/api/global')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.get_json()['chest_viewers'], {
'(12, 64, -7)': 1,
})
def test_drop_endpoint_supports_one_stack_and_matching_actions(self):
one = self.client.post('/api/inventory/drop', json={
'slot': 9, 'action': 'one'})