Fix request body structure for "Should reject keys claiming to belong to a different user"#1412
Conversation
This test was failing due to the shape of the request missing fields, rather than due to the user ID being different from the requester, which is what we're trying to test.
| "ed25519:".$user->device_id => "ed25519+key", | ||
| }, | ||
| signatures => {}, | ||
| }, |
There was a problem hiding this comment.
This is caused by changes from element-hq/synapse#17097 / element-hq/synapse#19023 ?
I'm a bit confused about how Sytest is passing on Synapse develop if it's from those PRs.
Or since it's optional, why it's failing in (unknown, as described in PR title)?
There was a problem hiding this comment.
The test was passing because it expects a 4xx error:
)->main::expect_http_4xx;
but, as explained in the PR description, we were getting a 400 due to the Pydantic model validation fail. Whereas the test is trying to check that the homeserver will return a 400 when uploading device keys for a user other than yourself.
| algorithms => ["m.olm.curve25519-aes-sha256", "m.megolm.v1.aes-sha"], | ||
| keys => { | ||
| "curve25519:".$user->device_id => "curve25519+key", | ||
| "ed25519:".$user->device_id => "ed25519+key", | ||
| }, | ||
| signatures => {}, |
There was a problem hiding this comment.
These fields make sense in terms of Pydantic model in Synapse (see DeviceKeys)
Feel free to merge if things make sense to you. The fields themselves seem sane.
|
Dendrite test failures appear unrelated to this PR. |
This was causing Synapse to respond with validation errors for these tests:
...which caused the test to fail (which we were expecting). Yet, we were looking for failure due to the wrong user ID being passed, not the request body's structure.
This PR fixes up the structure of the request body to avoid the validation error. We now see the correct error in the logs:
Ideally we would differentiate the errors based on
errcode, but the spec doesn't currently define any for this endpoint.