[WIP] initial tests for key backup#486
Conversation
| @@ -0,0 +1,271 @@ | |||
| my $fixture = local_user_fixture(); | |||
|
|
|||
| my $current_version; # FIXME: is there a better way of passing the backup version between tests? | |||
| method => "POST", | ||
| uri => "/unstable/room_keys/version", | ||
| content => { | ||
| algorithm => "m.megolm_backup.v1", |
There was a problem hiding this comment.
hm, shouldn't we use a real algorithm for this? (or is this a real one? it surprises me it doesn't include info about the ciphers being used, like the m.room.encryption algorithm does)
There was a problem hiding this comment.
That's the algorithm given in the proposal, but I agree, it should probably include some algorithm info
| $content->{auth_data} eq "anopaquestring" or | ||
| die "Expected auth_data to match submitted data"; | ||
|
|
||
| # FIXME: check that version matches the version returned above |
There was a problem hiding this comment.
hm, isn't this just comparing $current_version with $content->{version} or something?
There was a problem hiding this comment.
Yup, except that I don't think the version is returned yet, so I need to fix synapse to do that first. ;)
There was a problem hiding this comment.
So it turns out that Synapse does return the version, even though it wasn't in the proposal. 🤷♂️
There was a problem hiding this comment.
oops. i can imagine that i fixed up some of the thinkos in the proposal whilst doing the implementation, but then given the implementation never got fully finished, the proposal wasn't updated - sorry.
|
|
||
| assert_json_keys( $content, "auth_data" ); | ||
|
|
||
| $content->{algorithm} eq "m.megolm_backup.v1" or |
There was a problem hiding this comment.
nitpicking, but i'd probably factor out these constants in the name of DRY
There was a problem hiding this comment.
actually, ignore this, it's more legible at it is.
| $content->{first_message_index} == 1 or | ||
| die "Expected first message index to match submitted data"; | ||
|
|
||
| $content->{forwarded_count} == 0 or |
There was a problem hiding this comment.
we should probably exercise forwarded_count here too - perhaps just put another update attempt in here to check that forwarded keys don't trump non-forwarded ones? (iirc that's how the logic went)
|
lgtm, other than minor feedback! |
|
Reminder to myself before I forget: still need to check the bulk uploading/downloading endpoints, as well as the delete endpoints. Also the the get endpoints without a version specified |
|
I've added more tests in #486 |
|
Superseded by #503 |
tests for matrix-org/synapse#2731 (or whatever its successor will end up being)