Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkgs/id/src/web/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3950,7 +3950,7 @@ mod collab_route_tests {
doc_id
}

async fn get(uri: &str) -> (StatusCode, String) {
async fn get_doc(uri: &str) -> (StatusCode, String) {
let app = Router::new().route("/ws/collab/{doc_id}", get(echo_doc_id));
let response = app
.oneshot(Request::builder().uri(uri).body(Body::empty()).unwrap())
Expand All @@ -3964,7 +3964,7 @@ mod collab_route_tests {
#[tokio::test]
async fn encoded_slash_round_trips_to_the_exact_filename() {
assert_eq!(
get("/ws/collab/a%2Fb.md").await,
get_doc("/ws/collab/a%2Fb.md").await,
(StatusCode::OK, "a/b.md".to_owned())
);
}
Expand All @@ -3973,21 +3973,21 @@ mod collab_route_tests {
async fn encoded_percent_names_round_trip() {
// a%20b.md the file, not "a b.md": the client sends a%2520b.md.
assert_eq!(
get("/ws/collab/a%2520b.md").await,
get_doc("/ws/collab/a%2520b.md").await,
(StatusCode::OK, "a%20b.md".to_owned())
);
assert_eq!(
get("/ws/collab/100%25.md").await,
get_doc("/ws/collab/100%25.md").await,
(StatusCode::OK, "100%.md".to_owned())
);
assert_eq!(
get("/ws/collab/notes.md").await,
get_doc("/ws/collab/notes.md").await,
(StatusCode::OK, "notes.md".to_owned())
);
}

#[tokio::test]
async fn a_real_second_segment_does_not_match() {
assert_eq!(get("/ws/collab/a/b.md").await.0, StatusCode::NOT_FOUND);
assert_eq!(get_doc("/ws/collab/a/b.md").await.0, StatusCode::NOT_FOUND);
}
}
1 change: 1 addition & 0 deletions pkgs/id/tests/aliases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl Writer {
document: None,
removes: None,
note: None,
link: None,
};
let event = sign(&self.key, self.seq, self.last, None, ext).unwrap();
self.seq += 1;
Expand Down
2 changes: 2 additions & 0 deletions pkgs/id/tests/bridge_poc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ impl Author {
document: None,
removes: None,
note: None,
link: None,
};
let event = sign(&self.key, self.seq, self.last, None, ext).unwrap();
self.seq += 1;
Expand Down Expand Up @@ -195,6 +196,7 @@ impl Author {
document: None,
removes: None,
note: None,
link: None,
};
sign(&self.key, seq, backlink, Some(b"rival"), ext).unwrap()
}
Expand Down
3 changes: 3 additions & 0 deletions pkgs/id/tests/chain_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ fn chain_ext() -> impl Strategy<Value = ChainExt> {
document: None,
removes: None,
note: None,
link: None,
}
})
}
Expand Down Expand Up @@ -122,6 +123,7 @@ proptest! {
kind: "m".to_owned(),
group: None,
after: after.clone(), tag: None, document: None, removes: None, note: None,
link: None,
};
prop_assert!(sign(&key(), 0, None, None, ext.clone()).is_err());
prop_assert!(ext.validate().is_err());
Expand Down Expand Up @@ -189,6 +191,7 @@ proptest! {
kind: "m".to_owned(),
group: None,
after: Vec::new(), tag: None, document: None, removes: None, note: None,
link: None,
},
)
.encode();
Expand Down
1 change: 1 addition & 0 deletions pkgs/id/tests/cli_documents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ fn test_events_lists_the_tags_and_a_removal_on_a_document() {
document: None,
removes: Some(hash(&doc)),
note: None,
link: None,
},
);

Expand Down
3 changes: 3 additions & 0 deletions pkgs/id/tests/content_removal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ fn document_ext(doc: &DocumentRef, after: Vec<Hash>) -> ChainExt {
document: Some(doc.clone()),
removes: None,
note: None,
link: None,
}
}

Expand All @@ -113,6 +114,7 @@ fn tag_ext(subject: Hash, name: &str, value: &str, after: Vec<Hash>) -> ChainExt
document: None,
removes: None,
note: None,
link: None,
}
}

Expand All @@ -125,6 +127,7 @@ fn removal_ext(target: Hash, after: Vec<Hash>) -> ChainExt {
document: None,
removes: Some(target),
note: None,
link: None,
}
}

Expand Down
1 change: 1 addition & 0 deletions pkgs/id/tests/crash/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ fn workload() -> Vec<Vec<u8>> {
document: None,
removes: None,
note: None,
link: None,
};
let a0 = sign(&author, 0, None, None, ext("message", Vec::new())).unwrap();
let a1 = sign(&author, 1, Some(a0.id), None, ext("message", Vec::new())).unwrap();
Expand Down
3 changes: 3 additions & 0 deletions pkgs/id/tests/documents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ fn document_ext(doc: &DocumentRef, after: Vec<Hash>) -> ChainExt {
document: Some(doc.clone()),
removes: None,
note: None,
link: None,
}
}

Expand All @@ -122,6 +123,7 @@ fn tag_ext(op: TagOp, after: Vec<Hash>) -> ChainExt {
document: None,
removes: None,
note: None,
link: None,
}
}

Expand Down Expand Up @@ -380,6 +382,7 @@ fn test_a_document_event_that_does_not_fit_its_kind_is_not_signed() {
document: None,
removes: None,
note: None,
link: None,
};
assert!(sign(&key, 0, None, None, missing).is_err());
let with_tag = ChainExt {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/id/tests/event_store_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ fn signed(
document: None,
removes: None,
note: None,
link: None,
};
sign(key, seq, backlink, None, ext).unwrap()
}
Expand Down Expand Up @@ -337,6 +338,7 @@ fn present_event(
document: None,
removes: None,
note: None,
link: None,
};
sign(key, seq, backlink, None, ext).unwrap()
}
Expand Down Expand Up @@ -758,6 +760,7 @@ proptest! {
kind: "m".to_owned(),
group: None,
after: Vec::new(), tag: None, document: None, removes: None, note: None,
link: None,
},
)
.encode();
Expand Down Expand Up @@ -802,6 +805,7 @@ fn print_ingest_seeds() {
document: None,
removes: None,
note: None,
link: None,
};
sign(key, seq, backlink, None, ext).unwrap()
};
Expand Down
4 changes: 2 additions & 2 deletions pkgs/id/tests/game_post_async_turns_poc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! The #2053 investigation modelled a playable post as a board post that binds a
//! **game package**, a **play mode**, and a **state lineage**. This proves the
//! `async-turns` half of that on the checked-in tic-tac-toe program
//! (`examples/tic-tac-toe/tic-tac-toe.wasm`), with four scope points:
//! (`apps/tic-tac-toe/program/tic-tac-toe.wasm`), with four scope points:
//!
//! 1. a **game-post object** naming the package (hash + version), the mode, the
//! two players, and `attestation: concession`;
Expand All @@ -29,7 +29,7 @@ use serde_json::{Value, json};
use sha2::{Digest, Sha256};

/// The tic-tac-toe program, exactly as an app package would ship it.
const PACKAGE_WASM: &[u8] = include_bytes!("../examples/tic-tac-toe/tic-tac-toe.wasm");
const PACKAGE_WASM: &[u8] = include_bytes!("../apps/tic-tac-toe/program/tic-tac-toe.wasm");
/// The package version the posts in this file name. A bump is a new hash, and
/// old posts keep running the version they named.
const PACKAGE_VERSION: &str = "0.1.0";
Expand Down
2 changes: 2 additions & 0 deletions pkgs/id/tests/production_ingest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ impl Chains {
document: None,
removes: None,
note: None,
link: None,
};
let event = sign(&key(who), seq, backlink, body.as_deref(), ext).unwrap();
self.last.insert(who, (seq, event.id));
Expand Down Expand Up @@ -294,6 +295,7 @@ fn test_a_body_that_does_not_match_its_payload_hash_is_refused() {
document: None,
removes: None,
note: None,
link: None,
},
)
.unwrap();
Expand Down
2 changes: 2 additions & 0 deletions pkgs/id/tests/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ impl Writer {
document: Some(document),
removes: None,
note: None,
link: None,
})
}
}
Expand All @@ -102,6 +103,7 @@ fn tag_ext(kind: &str, op: TagOp, after: Vec<Hash>) -> ChainExt {
document: None,
removes: None,
note: None,
link: None,
}
}

Expand Down
3 changes: 3 additions & 0 deletions pkgs/id/tests/tag_claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl Writer {
document: None,
removes: None,
note: None,
link: None,
};
let event = sign(&self.key, self.seq, self.last, None, ext).unwrap();
self.seq += 1;
Expand Down Expand Up @@ -263,6 +264,7 @@ fn test_a_tag_event_whose_operation_does_not_fit_its_kind_is_not_signed() {
document: None,
removes: None,
note: None,
link: None,
};
assert!(sign(&a.key, 0, None, None, mismatch).is_err());
let missing = ChainExt {
Expand All @@ -273,6 +275,7 @@ fn test_a_tag_event_whose_operation_does_not_fit_its_kind_is_not_signed() {
document: None,
removes: None,
note: None,
link: None,
};
assert!(sign(&a.key, 0, None, None, missing).is_err());
}
Expand Down
1 change: 1 addition & 0 deletions pkgs/id/tests/voiding_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ fn scenario(seed: u64) -> Vec<Step> {
document: None,
removes: None,
note: None,
link: None,
};
let body = action.as_ref().map(|action| encode_body(action).unwrap());
let event = sign(&key(who), seq, backlink, body.as_deref(), ext).unwrap();
Expand Down
1 change: 1 addition & 0 deletions pkgs/id/tests/voiding_scenarios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ impl Builder {
document: None,
removes: None,
note: None,
link: None,
};
let body = action.as_ref().map(|action| encode_body(action).unwrap());
let event = sign(&key(who), seq, backlink, body.as_deref(), ext).unwrap();
Expand Down
Loading