-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
tests/41end-to-end-keys/07-backup.pl
Outdated
|
||
Future->done(1); | ||
matrix_get_backup_key( $user, '', '', 'bogusversion'); | ||
})->main::expect_http_404; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use expect_m_not_found
, to check the error code as well as the http code?
tests/41end-to-end-keys/07-backup.pl
Outdated
matrix_get_key_backup_info( $user )->then( sub { | ||
my ( $content ) = @_; | ||
|
||
log_if_fail "Content", $content; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we have a more descriptive description than "Content" ? (likewise below)
tests/41end-to-end-keys/07-backup.pl
Outdated
$version = $content->{version}; | ||
|
||
matrix_get_backup_key( $user, '!notaroom', 'notassession', $version); | ||
})->main::expect_http_4xx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this a 4xx rather than something more specific? Also, please can we have a comment to say what we are testing here?
tests/41end-to-end-keys/07-backup.pl
Outdated
|
||
$version = $content->{version}; | ||
|
||
matrix_get_backup_key( $user, '!notaroom', 'notassession', $version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a space before the )
tests/41end-to-end-keys/07-backup.pl
Outdated
@@ -393,9 +435,19 @@ =head2 matrix_get_backup_key | |||
sub matrix_get_backup_key { | |||
my ( $user, $room_id, $session_id, $version ) = @_; | |||
|
|||
my $uri; | |||
|
|||
if ($session_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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...)
tests/41end-to-end-keys/07-backup.pl
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, it would be useful to have some more words to explain what we are testing and what we expect the result to be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm apart from the nits below. Could you fix them, then merge?
tests/41end-to-end-keys/07-backup.pl
Outdated
@@ -384,18 +435,28 @@ sub matrix_backup_keys { | |||
|
|||
=head2 matrix_get_backup_key | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks wrong. could you fix it while you're here?
tests/41end-to-end-keys/07-backup.pl
Outdated
|
||
assert_deeply_eq( $content, { "rooms" => {} } ); | ||
|
||
Future->done(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need this
No description provided.