Merge remote-tracking branch 'origin/main' into phase5/gpui-shell-minors
This commit is contained in:
commit
daa2111ea1
12 files changed
+191
-46
No files matched your search
@@ -313,7 +313,7 @@ async fn the_conformance_suite_passes_on_a_session_of_the_registry() {
|
||||
}
|
||||
let report = conformance::run(&through_the_registry).await;
|
||||
assert_eq!(report.cases.len(), conformance::CASES.len());
|
||||
assert_eq!(report.cases.len(), 17, "the suite of c5bb6b9 has 17 cases");
|
||||
assert_eq!(report.cases.len(), 17, "the suite of v0.2.0 has 17 cases");
|
||||
assert!(
|
||||
report.cases.iter().all(|(_, verdict)| *verdict == Verdict::Passed),
|
||||
"{:?}",
|
||||
|
||||
@@ -333,7 +333,7 @@ enum Expect {
|
||||
}
|
||||
use Expect::{NotRun, Passes, Skipped};
|
||||
|
||||
/// Every case of the suite of the protocol repository at `c5bb6b9`, in its
|
||||
/// Every case of the suite of the protocol repository at `v0.2.0`, in its
|
||||
/// order, with what a TeamSpeak session does with it. A case the suite gains
|
||||
/// fails `the_suite_is_known` until it is listed here.
|
||||
///
|
||||
|
||||
@@ -791,6 +791,11 @@ fn pair(blob: &IdentityBlob) -> (String, String) {
|
||||
(blob.kind.clone(), blob.uid.clone())
|
||||
}
|
||||
|
||||
/// How many times a sign-out's list names the identity `key` (by kind and uid).
|
||||
fn times_listed(infos: &[IdentityInfo], key: &IdentityInfo) -> usize {
|
||||
infos.iter().filter(|info| info.kind == key.kind && info.uid == key.uid).count()
|
||||
}
|
||||
|
||||
/// The record of the install replaced by damaged JSON.
|
||||
fn damage_the_record(store: &SqliteKeyStore, json: &str) {
|
||||
let mut damaged = store.get(KIND_ACCOUNT, &record().blob_uid()).unwrap().unwrap();
|
||||
@@ -1887,9 +1892,19 @@ fn a_device_key_that_carries_a_binding_is_unbound_and_keeps_the_rest_of_its_row(
|
||||
};
|
||||
assert!(bound(&before), "the setup binds the key");
|
||||
|
||||
// It is listed once, as kept: VoelinProtocol before v0.2.0 listed a key whose
|
||||
// row carried the binding twice in `unbound`.
|
||||
let done = install.store.sign_out(&binding().account, DeviceKeyChoice::Auto).unwrap();
|
||||
assert!(done.unbound.contains(&device_key_info()), "{bound_existing_key}: {done:?}");
|
||||
assert!(!done.removed.contains(&device_key_info()), "{bound_existing_key}: {done:?}");
|
||||
assert_eq!(
|
||||
times_listed(&done.unbound, &device_key_info()),
|
||||
1,
|
||||
"{bound_existing_key}: {done:?}"
|
||||
);
|
||||
assert_eq!(
|
||||
times_listed(&done.removed, &device_key_info()),
|
||||
0,
|
||||
"{bound_existing_key}: {done:?}"
|
||||
);
|
||||
|
||||
let after = named_row(&db, KIND_VOELIN, &uid);
|
||||
assert!(!bound(&after), "{bound_existing_key}: unbound");
|
||||
@@ -1905,6 +1920,37 @@ fn a_device_key_that_carries_a_binding_is_unbound_and_keeps_the_rest_of_its_row(
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_device_key_that_carries_a_binding_is_listed_once_as_deleted_when_it_is_forgotten() {
|
||||
// The same row, named by `Forget`: the sign-out unbinds it in its loop over
|
||||
// the account's identities and deletes it after. It is listed once, as
|
||||
// deleted; VoelinProtocol before v0.2.0 also left it in `unbound`.
|
||||
for bound_existing_key in [true, false] {
|
||||
let Install { store, .. } = signed_in_install(bound_existing_key);
|
||||
let device_only = AccountBinding { synced: false, ..binding() };
|
||||
store.put(&IdentityBlob::voelin(&key()).unwrap().with_binding(device_only)).unwrap();
|
||||
|
||||
let done =
|
||||
store.sign_out(&binding().account, DeviceKeyChoice::Forget(key().uid())).unwrap();
|
||||
assert_eq!(
|
||||
times_listed(&done.removed, &device_key_info()),
|
||||
1,
|
||||
"{bound_existing_key}: {done:?}"
|
||||
);
|
||||
assert_eq!(
|
||||
times_listed(&done.unbound, &device_key_info()),
|
||||
0,
|
||||
"{bound_existing_key}: {done:?}"
|
||||
);
|
||||
assert!(store.voelin_key(&key().uid()).unwrap().is_none(), "the key is deleted");
|
||||
assert_eq!(store.account_record().unwrap(), None);
|
||||
assert_eq!(
|
||||
store.sign_out(&binding().account, DeviceKeyChoice::Auto).unwrap(),
|
||||
SignOut::default()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_sign_out_scrubs_the_copies_it_deletes_and_leaves_the_kept_keys_in_the_file() {
|
||||
// What a sign-out still deletes is a synced copy (a private key, which
|
||||
|
||||
Reference in new issue
Block a user