test(client-auth): update metadata test to reflect frozen-metadata behavior
Some checks failed
Some checks failed
This commit is contained in:
@@ -266,7 +266,7 @@ pub async fn metadata_unchanged_does_not_append_history() {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[test_log::test]
|
#[test_log::test]
|
||||||
pub async fn metadata_change_appends_history_and_repoints_binding() {
|
pub async fn metadata_frozen_after_approval_ignores_reconnect_changes() {
|
||||||
let db = db::create_test_pool().await;
|
let db = db::create_test_pool().await;
|
||||||
let actors = spawn_test_actors(&db).await;
|
let actors = spawn_test_actors(&db).await;
|
||||||
let new_key = MlDsa87::key_gen(&mut rand::rng());
|
let new_key = MlDsa87::key_gen(&mut rand::rng());
|
||||||
@@ -287,6 +287,7 @@ pub async fn metadata_change_appends_history_and_repoints_binding() {
|
|||||||
connect_client(props, &mut server_transport).await;
|
connect_client(props, &mut server_transport).await;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Reconnect presenting different metadata — must be silently ignored.
|
||||||
test_transport
|
test_transport
|
||||||
.send(auth::Inbound::AuthChallengeRequest {
|
.send(auth::Inbound::AuthChallengeRequest {
|
||||||
pubkey: verifying_key(&new_key).into(),
|
pubkey: verifying_key(&new_key).into(),
|
||||||
@@ -313,6 +314,7 @@ pub async fn metadata_change_appends_history_and_repoints_binding() {
|
|||||||
client_metadata, client_metadata_history, program_client,
|
client_metadata, client_metadata_history, program_client,
|
||||||
};
|
};
|
||||||
let mut conn = db.get().await.unwrap();
|
let mut conn = db.get().await.unwrap();
|
||||||
|
// Metadata is frozen: no new row, no history entry.
|
||||||
let metadata_count: i64 = client_metadata::table
|
let metadata_count: i64 = client_metadata::table
|
||||||
.count()
|
.count()
|
||||||
.get_result(&mut conn)
|
.get_result(&mut conn)
|
||||||
@@ -338,15 +340,16 @@ pub async fn metadata_change_appends_history_and_repoints_binding() {
|
|||||||
.first::<(String, Option<String>, Option<String>)>(&mut conn)
|
.first::<(String, Option<String>, Option<String>)>(&mut conn)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(metadata_count, 2);
|
assert_eq!(metadata_count, 1, "frozen: no new metadata row on reconnect");
|
||||||
assert_eq!(history_count, 1);
|
assert_eq!(history_count, 0, "frozen: no history entry on reconnect");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
current,
|
current,
|
||||||
(
|
(
|
||||||
"client".to_owned(),
|
"client".to_owned(),
|
||||||
Some("new".to_owned()),
|
Some("old".to_owned()),
|
||||||
Some("2.0.0".to_owned())
|
Some("1.0.0".to_owned())
|
||||||
)
|
),
|
||||||
|
"frozen: original metadata must be preserved"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user