upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/grasp-audit/src/fixtures.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-27 15:59:58 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-27 15:59:58 +0000
commitc4a35fe8421bc0a0e6608f1b153cb6043230e8b5 (patch)
tree435e7b199f1e66f7d92fb2b2bf0c04b00e8af28a /grasp-audit/src/fixtures.rs
parent33a8870b6015fb989430edbbf5810a2d7d1a5247 (diff)
Task 4: Refactor recursive maintainer push test to fixture-first pattern
- Deprecated setup_repo_for_recursive_maintainer helper in fixtures.rs - test_push_authorized_by_recursive_maintainer_state now creates own TestContext - Uses FixtureKind chain: RepoState, MaintainerAnnouncement, MaintainerState, RecursiveMaintainerRepoAndState - Uses git helpers from fixtures.rs (clone_repo, create_deterministic_commit_with_variant, try_push) - Updated imports to include RECURSIVE_MAINTAINER_DETERMINISTIC_COMMIT_HASH - All unit tests pass: cargo test --lib
Diffstat (limited to 'grasp-audit/src/fixtures.rs')
-rw-r--r--grasp-audit/src/fixtures.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/grasp-audit/src/fixtures.rs b/grasp-audit/src/fixtures.rs
index 571ab20..a7806ec 100644
--- a/grasp-audit/src/fixtures.rs
+++ b/grasp-audit/src/fixtures.rs
@@ -1435,6 +1435,34 @@ pub async fn setup_repo_for_maintainer(
1435 1435
1436/// Set up a recursive maintainer repository with deterministic commit 1436/// Set up a recursive maintainer repository with deterministic commit
1437/// 1437///
1438/// # Deprecated
1439///
1440/// This function is deprecated in favor of the fixture-first pattern.
1441/// Tests should create their own TestContext and use the fixture chain directly,
1442/// following the Generate → Send → Verify pattern.
1443///
1444/// See `test_push_authorized_by_recursive_maintainer_state` in `push_authorization.rs` for
1445/// an example of the fixture-first pattern with recursive maintainers.
1446///
1447/// ## Migration Guide
1448///
1449/// Instead of:
1450/// ```ignore
1451/// let setup = setup_repo_for_recursive_maintainer(client, git_data_dir, relay_domain).await?;
1452/// ```
1453///
1454/// Use:
1455/// ```ignore
1456/// let ctx = TestContext::new(client);
1457/// let state_event = ctx.get_fixture(FixtureKind::RepoState).await?;
1458/// ctx.get_fixture(FixtureKind::MaintainerAnnouncement).await?;
1459/// ctx.get_fixture(FixtureKind::MaintainerState).await?;
1460/// ctx.get_fixture(FixtureKind::RecursiveMaintainerRepoAndState).await?;
1461/// // Then clone, create deterministic commit with RecursiveMaintainer variant, and push inline
1462/// ```
1463///
1464/// ---
1465///
1438/// This performs all the common setup steps needed for recursive maintainer push authorization tests: 1466/// This performs all the common setup steps needed for recursive maintainer push authorization tests:
1439/// 1. Gets RepoState fixture (owner's repo announcement + state event with owner's deterministic commit) 1467/// 1. Gets RepoState fixture (owner's repo announcement + state event with owner's deterministic commit)
1440/// 2. Gets MaintainerAnnouncement fixture (maintainer's repo announcement with recursive maintainer in maintainers tag) 1468/// 2. Gets MaintainerAnnouncement fixture (maintainer's repo announcement with recursive maintainer in maintainers tag)
@@ -1449,6 +1477,10 @@ pub async fn setup_repo_for_maintainer(
1449/// 11. Pushes the commit so the grasp server has the state in the state event 1477/// 11. Pushes the commit so the grasp server has the state in the state event
1450/// 1478///
1451/// Returns RepoSetup which auto-cleans up the clone_path on drop 1479/// Returns RepoSetup which auto-cleans up the clone_path on drop
1480#[deprecated(
1481 since = "0.1.0",
1482 note = "Use fixture-first pattern with TestContext and fixture chain instead. See test_push_authorized_by_recursive_maintainer_state for example."
1483)]
1452pub async fn setup_repo_for_recursive_maintainer( 1484pub async fn setup_repo_for_recursive_maintainer(
1453 client: &crate::AuditClient, 1485 client: &crate::AuditClient,
1454 git_data_dir: &Path, 1486 git_data_dir: &Path,