fix tests for real

This commit is contained in:
Sorunome 2020-06-04 18:16:22 +02:00
parent f3f3231df6
commit c94e41d393
No known key found for this signature in database
GPG key ID: B19471D07FC9BE9C
3 changed files with 4 additions and 7 deletions

View file

@ -179,12 +179,9 @@ class OlmManager {
: null, : null,
oneTimeKeys: signedOneTimeKeys, oneTimeKeys: signedOneTimeKeys,
); );
if (response['signed_curve25519'] != oneTimeKeysCount) {
return false;
}
_olmAccount.mark_keys_as_published(); _olmAccount.mark_keys_as_published();
await client.database?.updateClientKeys(pickledOlmAccount, client.id); await client.database?.updateClientKeys(pickledOlmAccount, client.id);
return true; return response['signed_curve25519'] == oneTimeKeysCount;
} }
void handleDeviceOneTimeKeysCount(Map<String, int> countJson) { void handleDeviceOneTimeKeysCount(Map<String, int> countJson) {

View file

@ -159,7 +159,7 @@ void main() {
expect(presenceCounter, 1); expect(presenceCounter, 1);
expect(accountDataCounter, 3); expect(accountDataCounter, 3);
await Future.delayed(Duration(milliseconds: 50)); await Future.delayed(Duration(milliseconds: 50));
expect(matrix.userDeviceKeys.length, 3); expect(matrix.userDeviceKeys.length, 4);
expect(matrix.userDeviceKeys['@alice:example.com'].outdated, false); expect(matrix.userDeviceKeys['@alice:example.com'].outdated, false);
expect(matrix.userDeviceKeys['@alice:example.com'].deviceKeys.length, 2); expect(matrix.userDeviceKeys['@alice:example.com'].deviceKeys.length, 2);
expect( expect(
@ -178,7 +178,7 @@ void main() {
} }
})); }));
await Future.delayed(Duration(milliseconds: 50)); await Future.delayed(Duration(milliseconds: 50));
expect(matrix.userDeviceKeys.length, 2); expect(matrix.userDeviceKeys.length, 3);
expect(matrix.userDeviceKeys['@alice:example.com'].outdated, true); expect(matrix.userDeviceKeys['@alice:example.com'].outdated, true);
await matrix.handleSync(SyncUpdate.fromJson({ await matrix.handleSync(SyncUpdate.fromJson({

View file

@ -1598,7 +1598,7 @@ class FakeMatrixApi extends MockClient {
'/client/r0/keys/upload': (var req) => { '/client/r0/keys/upload': (var req) => {
'one_time_key_counts': { 'one_time_key_counts': {
'curve25519': 10, 'curve25519': 10,
'signed_curve25519': 66, 'signed_curve25519': json.decode(req)['one_time_keys']?.keys?.length ?? 0,
} }
}, },
'/client/r0/keys/query': (var req) => { '/client/r0/keys/query': (var req) => {