diff options
author | Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> | 2020-10-26 15:07:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-26 14:07:51 +0000 |
commit | 913f8a06e43da760ccef329d43c139ec3c7fd7d5 (patch) | |
tree | 377eedebad84886f8ae59bed279060094179770e /tests/rest/admin | |
parent | Check status codes that profile handler returns (#8580) (diff) | |
download | synapse-913f8a06e43da760ccef329d43c139ec3c7fd7d5.tar.xz |
Add field `total` to device list in admin API (#8644)
Diffstat (limited to 'tests/rest/admin')
-rw-r--r-- | tests/rest/admin/test_device.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/rest/admin/test_device.py b/tests/rest/admin/test_device.py index 92c9058887..d89eb90cfe 100644 --- a/tests/rest/admin/test_device.py +++ b/tests/rest/admin/test_device.py @@ -393,6 +393,22 @@ class DevicesRestTestCase(unittest.HomeserverTestCase): self.assertEqual(400, channel.code, msg=channel.json_body) self.assertEqual("Can only lookup local users", channel.json_body["error"]) + def test_user_has_no_devices(self): + """ + Tests that a normal lookup for devices is successfully + if user has no devices + """ + + # Get devices + request, channel = self.make_request( + "GET", self.url, access_token=self.admin_user_tok, + ) + self.render(request) + + self.assertEqual(200, channel.code, msg=channel.json_body) + self.assertEqual(0, channel.json_body["total"]) + self.assertEqual(0, len(channel.json_body["devices"])) + def test_get_devices(self): """ Tests that a normal lookup for devices is successfully @@ -409,6 +425,7 @@ class DevicesRestTestCase(unittest.HomeserverTestCase): self.render(request) self.assertEqual(200, channel.code, msg=channel.json_body) + self.assertEqual(number_devices, channel.json_body["total"]) self.assertEqual(number_devices, len(channel.json_body["devices"])) self.assertEqual(self.other_user, channel.json_body["devices"][0]["user_id"]) # Check that all fields are available |