add and update tests for new behaviour with empty backups#519
Conversation
|
corresponds to matrix-org/synapse#4123 |
|
The tests in the corresponding synapse PR run fine, so I'm not sure why they're failing here, and the test results seem to be empty. Unless it was because I did a force-push to the synapse branch while these tests were running... 🤷♂️ |
-- for some reason, synapse didn't start. @matrixbot retest this please |
|
|
||
| Future->done(1); | ||
| matrix_get_backup_key( $user, '', '', 'bogusversion'); | ||
| })->main::expect_http_404; |
There was a problem hiding this comment.
can you use expect_m_not_found, to check the error code as well as the http code?
| matrix_get_key_backup_info( $user )->then( sub { | ||
| my ( $content ) = @_; | ||
|
|
||
| log_if_fail "Content", $content; |
There was a problem hiding this comment.
could we have a more descriptive description than "Content" ? (likewise below)
| $version = $content->{version}; | ||
|
|
||
| matrix_get_backup_key( $user, '!notaroom', 'notassession', $version); | ||
| })->main::expect_http_4xx |
There was a problem hiding this comment.
why is this a 4xx rather than something more specific? Also, please can we have a comment to say what we are testing here?
|
|
||
| $version = $content->{version}; | ||
|
|
||
| matrix_get_backup_key( $user, '!notaroom', 'notassession', $version); |
|
|
||
| my $uri; | ||
|
|
||
| if ($session_id) { |
There was a problem hiding this comment.
probably better to check for definedness rather than truthiness (if ( defined $session_id )) to distinguish between an absent param and an empty one.
Also, spaces inside parens please. (I don't make the rules...)
| matrix_get_backup_key( $user, '!notaroom', 'notassession', $version); | ||
| })->main::expect_http_4xx | ||
| ->then( sub { | ||
| matrix_get_backup_key( $user, '!notaroom', '', $version); |
There was a problem hiding this comment.
Again, it would be useful to have some more words to explain what we are testing and what we expect the result to be.
richvdh
left a comment
There was a problem hiding this comment.
lgtm apart from the nits below. Could you fix them, then merge?
| matrix_get_backup_key( $user, $room_id, $session_id, $version ) | ||
| matrix_get_backup_key( $user, $version, $room_id, $session_id ) | ||
|
|
||
| Send keys to a given key backup version |
There was a problem hiding this comment.
this looks wrong. could you fix it while you're here?
|
|
||
| assert_deeply_eq( $content, { "rooms" => {} } ); | ||
|
|
||
| Future->done(1); |
No description provided.