Add world time to web dashboard

This commit is contained in:
Tanner
2026-11-08 17:26:43 +00:00
parent ea887c7019
commit e290aa25fa
5 changed files with 32 additions and 1 deletions
+11 -1
View File
@@ -32,7 +32,7 @@ class TestWebInventoryAPI(unittest.TestCase):
self.g = mosfet_web.g
self.original = {
key: self.g.get(key) for key in
('connected', 'game', 'inv', 'chest_viewers')
('connected', 'game', 'inv', 'chest_viewers', 'time', 'time_base')
}
self.game = FakeGame()
self.g.connected = True
@@ -54,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_exposes_world_time_ticks(self):
self.g.time = 12345.5
self.g.time_base = 12345.5
response = self.client.get('/api/global')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.get_json()['time'], 12345.5)
self.assertEqual(response.get_json()['time_base'], 12345.5)
def test_global_api_stringifies_tuple_keys(self):
self.g.chest_viewers = {(12, 64, -7): 1}