Tests for e2e key backup interface#503
Conversation
Make sure keys from old backups don't appear in newly created ones element-hq/element-web#7448
erikjohnston
left a comment
There was a problem hiding this comment.
Wooo, tests! Sorry that I'm not a fan of interdependent tests :(
|
|
||
| assert_json_keys( $content, "is_verified" ); | ||
|
|
||
| assert_json_keys( $content, "session_data" ); |
There was a problem hiding this comment.
You can do:
assert_json_keys( $content, qw( first_message_index forwarded_count is_verified session_data ) )| is_verified => JSON::false, | ||
| session_data => "anopaquestring", | ||
| } | ||
| ); |
| content => { | ||
| algorithm => "m.megolm_backup.v1", | ||
| auth_data => "anopaquestring", | ||
| } |
There was a problem hiding this comment.
I think its going to be beneficial if we create matrix_create_backup_version etc functions. There's already a fair bit of duplication and it'll make it easier to write more backup tests.
| @@ -0,0 +1,387 @@ | |||
| my $fixture = local_user_fixture(); | |||
|
|
|||
| my $current_version; # FIXME: is there a better way of passing the backup version between tests? | |||
There was a problem hiding this comment.
I would prefer if each test was a standalone test, rather than there being implicit dependencies (it makes it harder to reason about each test and change later on).
I think once the APIs are split out into separate functions that will reduce boiler plate enough to make it feasible to just start from scratch for each test. There are also multi_test if you want to do multiple tests in one run through.
| assert_json_keys( $content, "session_data" ); | ||
|
|
||
| $content->{first_message_index} == 1 or | ||
| die "Expected first message index to match submitted data"; |
There was a problem hiding this comment.
I think you want to use assert_eq( $content->{first_message_index}, 1, ".." ) as it will have better logging on failures (in terms of logging what the actual values were?)
Factor the common HTTP hits out into matrix_* subs and make the tests independent from one another.
|
This should be better! ptal :) |
No description provided.