mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-09 09:05:05 -04:00
Fix dehydrated device REST checks (#14336)
This commit is contained in:
parent
cc3a52b33d
commit
dbfc9b803e
3 changed files with 37 additions and 3 deletions
|
@ -200,3 +200,37 @@ class DevicesTestCase(unittest.HomeserverTestCase):
|
|||
self.reactor.advance(43200)
|
||||
self.get_success(self.handler.get_device(user_id, "abc"))
|
||||
self.get_failure(self.handler.get_device(user_id, "def"), NotFoundError)
|
||||
|
||||
|
||||
class DehydratedDeviceTestCase(unittest.HomeserverTestCase):
|
||||
servlets = [
|
||||
admin.register_servlets_for_client_rest_resource,
|
||||
login.register_servlets,
|
||||
register.register_servlets,
|
||||
devices.register_servlets,
|
||||
]
|
||||
|
||||
def test_PUT(self) -> None:
|
||||
"""Sanity-check that we can PUT a dehydrated device.
|
||||
|
||||
Detects https://github.com/matrix-org/synapse/issues/14334.
|
||||
"""
|
||||
alice = self.register_user("alice", "correcthorse")
|
||||
token = self.login(alice, "correcthorse")
|
||||
|
||||
# Have alice update their device list
|
||||
channel = self.make_request(
|
||||
"PUT",
|
||||
"_matrix/client/unstable/org.matrix.msc2697.v2/dehydrated_device",
|
||||
{
|
||||
"device_data": {
|
||||
"algorithm": "org.matrix.msc2697.v1.dehydration.v1.olm",
|
||||
"account": "dehydrated_device",
|
||||
}
|
||||
},
|
||||
access_token=token,
|
||||
shorthand=False,
|
||||
)
|
||||
self.assertEqual(channel.code, HTTPStatus.OK, channel.json_body)
|
||||
device_id = channel.json_body.get("device_id")
|
||||
self.assertIsInstance(device_id, str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue