aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-28 08:54:05 +0100
committerDanilo M. <danix@danix.xyz>2026-11-28 08:54:05 +0100
commit8397638ec70b23e05ef490e15f5d7c5c05e52d1f (patch)
treea0750ff7254b2437e01e29461955f20dace94e84 /tests
parentd842b3c49fe4c03993f32fb9bebbef954c54675d (diff)
downloaddeck-it-8397638ec70b23e05ef490e15f5d7c5c05e52d1f.tar.gz
deck-it-8397638ec70b23e05ef490e15f5d7c5c05e52d1f.zip
feat(xbox): save a capture to the PC
The viewer's "Save to PC" asks the server to download the capture into Pictures/Xbox (screenshots) or Videos/Xbox (clips), named by title and capture date; the old link stays as "Tablet". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xbox.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/test_xbox.py b/tests/test_xbox.py
index a05ba60..85146a4 100644
--- a/tests/test_xbox.py
+++ b/tests/test_xbox.py
@@ -412,6 +412,26 @@ class Tick(Base):
self.assertEqual(self.status.read_text(), "0")
+class Save(Base):
+ def test_a_listed_capture_is_saved_under_its_user_dir(self):
+ x = self.xbox()
+ x.tick()
+ d = Path(tempfile.mkdtemp())
+ src = d / "src.mp4"
+ src.write_bytes(b"clip")
+ x.data["captures"][0]["url"] = src.as_uri() # C1, the clip
+ old = xb.user_dir
+ xb.user_dir = lambda name: d / name
+ try:
+ path = Path(x.save({"id": "C1"})["path"])
+ with self.assertRaises(xb.ModuleError):
+ x.save({"id": "NOPE"})
+ finally:
+ xb.user_dir = old
+ self.assertEqual(path, d / "VIDEOS" / "Xbox" / "Some Game 2026-11-23T10-00-00.mp4")
+ self.assertEqual(path.read_bytes(), b"clip")
+
+
class Commands(Base):
def test_a_command_goes_to_xccs(self):
x = self.xbox()
@@ -458,7 +478,7 @@ class Commands(Base):
def test_make_lists_the_actions(self):
m = xb.make({"xbox": {"client_id": ""}})
- self.assertEqual(set(m.actions), {"login", *xb.COMMANDS})
+ self.assertEqual(set(m.actions), {"login", "save", *xb.COMMANDS})
self.assertEqual(m.state(), {"offline": True, "unconfigured": True})