aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_xbox.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-16 17:38:23 +0100
committerDanilo M. <danix@danix.xyz>2026-11-16 17:38:23 +0100
commitdf7b5062118467dc02d3baade9a6b74390c050ba (patch)
tree8627ca013e237c3494d4b13bea97a3a4ba6fe651 /tests/test_xbox.py
parentaaf950fa5461d7879ca28371f1c788f4daaaaed2 (diff)
downloaddeck-it-df7b5062118467dc02d3baade9a6b74390c050ba.tar.gz
deck-it-df7b5062118467dc02d3baade9a6b74390c050ba.zip
feat(xbox): console model, region, flags and installed titles
Diffstat (limited to 'tests/test_xbox.py')
-rw-r--r--tests/test_xbox.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_xbox.py b/tests/test_xbox.py
index 1b73a2d..f70aa6f 100644
--- a/tests/test_xbox.py
+++ b/tests/test_xbox.py
@@ -36,6 +36,10 @@ CONSOLES = {"status": {"errorCode": "OK"}, "result": [
PROFILE = {"profileUsers": [{"id": "1", "settings": [
{"id": "Gamertag", "value": "Player"}, {"id": "GameDisplayPicRaw", "value": "https://img.example.org/p.png"},
{"id": "Gamerscore", "value": "12345"}]}]}
+APPS = {"result": [
+ {"name": "Small App", "contentType": "App", "sizeInBytes": 1e8, "version": 7, "installTime": "2026-10-01T00:00:00Z"},
+ {"name": "Big Game", "contentType": "Game", "sizeInBytes": 9e10, "version": 12, "installTime": "2026-09-01T00:00:00Z",
+ "updateTime": "2026-11-10T00:00:00Z", "lastActiveTime": "2026-11-15T21:00:00Z"}]}
HISTORY = {"titles": [
{"titleId": "1234", "name": "Some Game", "type": "Game", "displayImage": "https://img.example.org/c.png",
"titleHistory": {"lastTimePlayed": "2026-11-16T10:00:00Z"},
@@ -76,6 +80,7 @@ class Fake:
"achievements.xboxlive.com": ACHIEVEMENTS,
"peoplehub": FRIENDS,
"/commands": {"status": {"errorCode": "OK"}, "opId": "op"},
+ "/lists/installedApps": APPS,
}
self.answers.update(over)
@@ -167,6 +172,12 @@ class Summaries(unittest.TestCase):
self.assertEqual((c["id"], c["name"], c["power"]), ("CON1", "Living room", "On"))
self.assertEqual(c["storage"], [{"name": "Internal", "free": 4e11, "total": 1e12}])
+ def test_apps_biggest_first(self):
+ a = xb.summarize_apps(APPS)
+ self.assertEqual([x["name"] for x in a], ["Big Game", "Small App"])
+ self.assertEqual((a[0]["game"], a[0]["version"], a[0]["updated"]), (True, 12, "2026-11-10T00:00:00Z"))
+ self.assertEqual(a[1]["updated"], "2026-10-01T00:00:00Z") # never updated: the install time
+
def test_minutes_and_titles(self):
minutes = xb.minutes_played(STATS)
self.assertEqual(minutes, {"1234": 185})
@@ -240,6 +251,8 @@ class Tick(Base):
self.assertEqual(st["titles"][0]["minutes"], 185)
self.assertEqual(st["achievements"][0]["score"], 15)
self.assertEqual(st["friends"][0]["gamertag"], "amy")
+ self.assertEqual(st["apps"]["CON1"][0]["name"], "Big Game")
+ self.assertIn("deviceId=CON1", self.fake.urls("/lists/installedApps")[0][0])
self.assertEqual(st["playing"]["name"], "Some Game")
self.assertIsInstance(st["session"], int)
self.assertEqual(self.status.read_text(), "1")