summary refs log tree commit diff
path: root/tests/handlers/test_device.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-07-25 17:51:24 +0100
committerRichard van der Hoff <richard@matrix.org>2016-07-26 07:35:48 +0100
commit012b4c19132d57fdbc1b6b0e304eb60eaf19200f (patch)
tree93570c6bc031416b50061e3bc1f83fb519dca007 /tests/handlers/test_device.py
parentImplement deleting devices (diff)
downloadsynapse-012b4c19132d57fdbc1b6b0e304eb60eaf19200f.tar.xz
Implement updating devices
You can update the displayname of devices now.
Diffstat (limited to 'tests/handlers/test_device.py')
-rw-r--r--tests/handlers/test_device.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/handlers/test_device.py b/tests/handlers/test_device.py
index 214e722eb3..85a970a6c9 100644
--- a/tests/handlers/test_device.py
+++ b/tests/handlers/test_device.py
@@ -140,6 +140,22 @@ class DeviceTestCase(unittest.TestCase):
         # we'd like to check the access token was invalidated, but that's a
         # bit of a PITA.
 
+    @defer.inlineCallbacks
+    def test_update_device(self):
+        yield self._record_users()
+
+        update = {"display_name": "new display"}
+        yield self.handler.update_device(user1, "abc", update)
+
+        res = yield self.handler.get_device(user1, "abc")
+        self.assertEqual(res["display_name"], "new display")
+
+    @defer.inlineCallbacks
+    def test_update_unknown_device(self):
+        update = {"display_name": "new_display"}
+        with self.assertRaises(synapse.api.errors.NotFoundError):
+            yield self.handler.update_device("user_id", "unknown_device_id",
+                                             update)
 
     @defer.inlineCallbacks
     def _record_users(self):