Skip to content

Commit 9be99aa

Browse files
committed
Address PR review feedback (#448)
- assert the exact not_found body shape for both held and absent bounty ids in the mutation-gate helper, so a denial carrying lifecycle or participant detail fails the test
1 parent a4da137 commit 9be99aa

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

‎crates/gitlawb-node/src/test_support.rs‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14825,19 +14825,31 @@ mod tests {
1482514825
"{route} on a held private-repo bounty id must deny as 404, not a \
1482614826
distinguishable status/participant error"
1482714827
);
14828-
let msg = json_body(resp).await;
14829-
assert!(
14830-
msg["message"].as_str().unwrap_or("").contains("not found"),
14831-
"{route} denial body must be the not-found shape, got {msg}"
14832-
);
14828+
let held_body = json_body(resp).await;
1483314829

14834-
// Absent id: the control case, already 404 today.
14830+
// Absent id: the control case. The body must carry the same not_found
14831+
// shape so a denial discloses nothing beyond the caller-supplied id.
1483514832
let absent_uri = format!("/api/v1/bounties/b341-no-such-id/{route}");
1483614833
let resp = router
1483714834
.oneshot(signed_bounty_post(&stranger, &absent_uri, body))
1483814835
.await
1483914836
.unwrap();
1484014837
assert_eq!(resp.status(), StatusCode::NOT_FOUND);
14838+
let absent_body = json_body(resp).await;
14839+
14840+
for (id, got) in [
14841+
("b341-held-id", &held_body),
14842+
("b341-no-such-id", &absent_body),
14843+
] {
14844+
assert_eq!(
14845+
*got,
14846+
serde_json::json!({
14847+
"error": "not_found",
14848+
"message": format!("bounty {id} not found"),
14849+
}),
14850+
"{route} denial body for {id} must be the bare not-found shape, got {got}"
14851+
);
14852+
}
1484114853
}
1484214854

1484314855
#[sqlx::test]

0 commit comments

Comments
 (0)