fix(federation): dedupe accidentally double-inserted trust-threading tests
The tests landed twice (interrupted edit applied both paths), breaking the test build with E0428. Federation suite: 33/33 green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
950549304d
commit
2434c55f32
@ -470,66 +470,6 @@ mod tests {
|
||||
assert_eq!(parsed.trust_level, TrustLevel::Trusted);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_observer_invite_threads_trust_level() {
|
||||
// "Invite a Peer" mints an observer invite; the acceptor must land
|
||||
// on Observer, not Trusted (the original bug).
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let code = create_invite(
|
||||
dir.path(),
|
||||
"did:key:zRemote",
|
||||
"remote.onion",
|
||||
"remotepub",
|
||||
None,
|
||||
TrustLevel::Observer,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let parsed = parse_invite(&code).unwrap();
|
||||
assert_eq!(parsed.trust_level, TrustLevel::Observer);
|
||||
|
||||
let dir2 = tempfile::tempdir().unwrap();
|
||||
let node = accept_invite(
|
||||
dir2.path(),
|
||||
&code,
|
||||
"did:key:zLocal",
|
||||
"local.onion",
|
||||
"localpub",
|
||||
None,
|
||||
None,
|
||||
|_| "test-sig".to_string(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(node.trust_level, TrustLevel::Observer);
|
||||
|
||||
// The inviter's stored outgoing invite carries the level too — this
|
||||
// is what peer-joined uses as the authoritative grant on the far side.
|
||||
let invites = load_invites(dir.path()).await.unwrap();
|
||||
assert_eq!(invites.outgoing.len(), 1);
|
||||
assert_eq!(invites.outgoing[0].trust_level, TrustLevel::Observer);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_legacy_invite_defaults_to_trusted() {
|
||||
// Codes minted before the trust field existed must stay Trusted.
|
||||
use base64::Engine;
|
||||
let legacy = serde_json::json!({
|
||||
"did": "did:key:zOld",
|
||||
"onion": "old.onion",
|
||||
"pubkey": "00",
|
||||
"token": "aa",
|
||||
});
|
||||
let code = format!(
|
||||
"fed1:{}",
|
||||
base64::engine::general_purpose::URL_SAFE_NO_PAD
|
||||
.encode(serde_json::to_string(&legacy).unwrap())
|
||||
);
|
||||
let parsed = parse_invite(&code).unwrap();
|
||||
assert_eq!(parsed.trust_level, TrustLevel::Trusted);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_invalid_invite() {
|
||||
assert!(parse_invite("invalid").is_err());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user