Remove another weird test
This commit is contained in:
parent
8cd1637dae
commit
f00992d4a5
1 changed files with 0 additions and 48 deletions
|
|
@ -240,52 +240,4 @@ fn pending_forward_from_row(row: &rusqlite::Row<'_>) -> rusqlite::Result<Pending
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
fn suffix(name: &str) -> String {
|
|
||||||
let unix = std::time::SystemTime::now()
|
|
||||||
.duration_since(std::time::UNIX_EPOCH)
|
|
||||||
.unwrap_or_default()
|
|
||||||
.as_nanos();
|
|
||||||
format!("{name}-{unix}")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn stores_and_retrieves_chat_secret_blob_for_owner_chat() {
|
|
||||||
let user_id = suffix("user");
|
|
||||||
let chat_id = suffix("chat");
|
|
||||||
|
|
||||||
put_chat_secret(StoredChatSecret {
|
|
||||||
user_id: user_id.clone(),
|
|
||||||
chat_id: chat_id.clone(),
|
|
||||||
secret_id: "main".to_string(),
|
|
||||||
version: 1,
|
|
||||||
encrypted_secret: vec![42, 43],
|
|
||||||
kem_ciphertext: vec![9, 8, 7],
|
|
||||||
wrapping_scheme: "mtp-kem-chacha20poly1305-hkdf-sha256-v1".to_string(),
|
|
||||||
created_at: 1,
|
|
||||||
updated_at: 2,
|
|
||||||
})
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let found = get_chat_secret(ChatSecretQuery {
|
|
||||||
user_id: user_id.clone(),
|
|
||||||
chat_id: chat_id.clone(),
|
|
||||||
secret_id: Some("main".to_string()),
|
|
||||||
})
|
|
||||||
.unwrap()
|
|
||||||
.unwrap();
|
|
||||||
assert_eq!(found.encrypted_secret, vec![42, 43]);
|
|
||||||
assert_eq!(found.kem_ciphertext, vec![9, 8, 7]);
|
|
||||||
|
|
||||||
let denied = get_chat_secret(ChatSecretQuery {
|
|
||||||
user_id: suffix("other-user"),
|
|
||||||
chat_id,
|
|
||||||
secret_id: Some("main".to_string()),
|
|
||||||
})
|
|
||||||
.unwrap();
|
|
||||||
assert!(denied.is_none());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue