test: pin accepted_state's contract — main tier, blocked, never accepted
This commit is contained in:
parent
1c4011325f
commit
45987fe03d
1 changed files with 12 additions and 0 deletions
|
|
@ -901,6 +901,18 @@ mod tests {
|
||||||
assert_eq!(store.history("alice@example.org").unwrap(), [([9u8; 32], 42)]);
|
assert_eq!(store.history("alice@example.org").unwrap(), [([9u8; 32], 42)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn accepted_state_reads_the_row_not_a_wish() {
|
||||||
|
let store = temp_store("accepted-state");
|
||||||
|
let identity = [9u8; KEY_LEN];
|
||||||
|
assert_eq!(store.accepted_state("a@example.org").unwrap(), None);
|
||||||
|
store.accept("a@example.org", &identity).unwrap();
|
||||||
|
assert_eq!(store.accepted_state("a@example.org").unwrap(), Some(true));
|
||||||
|
// block() is an UPDATE, not a DELETE: the row survives at active = 0.
|
||||||
|
store.block("a@example.org").unwrap();
|
||||||
|
assert_eq!(store.accepted_state("a@example.org").unwrap(), Some(false));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn unpin_returns_to_trust_on_first_use() {
|
fn unpin_returns_to_trust_on_first_use() {
|
||||||
let store = temp_store("unpin");
|
let store = temp_store("unpin");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue