diff options
Diffstat (limited to 'tests/test_xbox.py')
| -rw-r--r-- | tests/test_xbox.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_xbox.py b/tests/test_xbox.py index 0bcc883..a05ba60 100644 --- a/tests/test_xbox.py +++ b/tests/test_xbox.py @@ -63,6 +63,13 @@ FRIENDS = {"people": [ {"gamertag": "zed", "displayPicRaw": "z.png", "presenceState": "Offline", "presenceText": "Offline", "isFavorite": True}, {"gamertag": "bob", "displayPicRaw": "b.png", "presenceState": "Online", "presenceText": "Some Game", "isFavorite": False}, {"gamertag": "amy", "displayPicRaw": "a.png", "presenceState": "Online", "presenceText": "Home", "isFavorite": True}]} +SHOTS = {"values": [{"contentId": "S1", "titleName": "Some Game", "captureDate": "2026-11-22T14:08:54Z", + "expirationDate": "2027-02-20T14:09:07Z", "contentLocators": [ + {"locatorType": "Download", "uri": "https://cdn.example.org/s1.png?sig=x"}, + {"locatorType": "Thumbnail_Large", "uri": "https://cdn.example.org/s1_t.png"}]}]} +CLIPS = {"values": [{"contentId": "C1", "titleName": "Some Game", "captureDate": "2026-11-23T10:00:00Z", + "durationInSeconds": 30, "contentLocators": [{"locatorType": "Download", "uri": "https://cdn.example.org/c1.mp4"}]}, + {"contentId": "C2", "contentLocators": []}]} XSTS = {"Token": "XT", "DisplayClaims": {"xui": [{"uhs": "UHS", "xid": "1"}]}} @@ -90,6 +97,8 @@ class Fake: "/commands": {"status": {"errorCode": "OK"}, "opId": "op"}, "/lists/installedApps": APPS, "/titles/batch/": BATCH, + "mediahub.xboxlive.com/screenshots": SHOTS, + "mediahub.xboxlive.com/gameclips": CLIPS, } self.answers.update(over) @@ -212,6 +221,13 @@ class Summaries(unittest.TestCase): def test_friends_online_then_favourite_then_name(self): self.assertEqual([f["gamertag"] for f in xb.summarize_friends(FRIENDS)], ["amy", "bob", "zed"]) + def test_captures_newest_first_without_a_download_skipped(self): + c = xb.summarize_captures(SHOTS, CLIPS) + self.assertEqual([(x["id"], x["kind"]) for x in c], [("C1", "clip"), ("S1", "shot")]) + self.assertEqual((c[1]["thumb"], c[1]["url"]), + ("https://cdn.example.org/s1_t.png", "https://cdn.example.org/s1.png?sig=x")) + self.assertEqual(c[0]["seconds"], 30) + class Login(Base): def test_no_client_id_refuses(self): @@ -269,6 +285,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(len(st["captures"]), 2) + self.assertEqual(self.fake.urls("mediahub")[0][1]["query"], "OwnerXuid eq 1") self.assertIn("deviceId=CON1", self.fake.urls("/lists/installedApps")[0][0]) # the installed game missing from the recent ones comes from the batch, by pfn self.assertEqual(self.fake.urls("/titles/batch/")[0][1]["pfns"], ["Old.Game_x"]) |
