upleb.uk

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

summaryrefslogtreecommitdiff
path: root/grasp-audit
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-12-23 14:00:50 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-12-23 14:00:50 +0000
commitea3f90d3952f0a1760dbb03ff4a706731534514c (patch)
tree0e91b403f012f6fe94807c101339262380dfc4e5 /grasp-audit
parent2ce9b2831e3af536f31491344abdf4b897f67a69 (diff)
test: remove test covered elsewhere
as new feature purgatory is going to complicate having this test here. it will be better to have this covered in push authorisation
Diffstat (limited to 'grasp-audit')
-rw-r--r--grasp-audit/src/specs/grasp01/event_acceptance_policy.rs76
1 files changed, 0 insertions, 76 deletions
diff --git a/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs b/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs
index 00a48fd..3db1446 100644
--- a/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs
+++ b/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs
@@ -110,9 +110,6 @@ impl EventAcceptancePolicyTests {
110 results.add(Self::test_reject_repo_announcement_missing_relays_tag(client).await); 110 results.add(Self::test_reject_repo_announcement_missing_relays_tag(client).await);
111 results.add(Self::test_accept_maintainer_announcement_without_service_listed(client).await); 111 results.add(Self::test_accept_maintainer_announcement_without_service_listed(client).await);
112 112
113 // Repository State Announcement Tests
114 results.add(Self::test_accept_valid_repo_state_announcement(client).await);
115
116 // Group 1: Accept Events Tagging Accepted Repositories 113 // Group 1: Accept Events Tagging Accepted Repositories
117 results.add(Self::test_accept_issue_via_a_tag(client).await); 114 results.add(Self::test_accept_issue_via_a_tag(client).await);
118 results.add(Self::test_accept_comment_via_capital_a_tag(client).await); 115 results.add(Self::test_accept_comment_via_capital_a_tag(client).await);
@@ -537,79 +534,6 @@ impl EventAcceptancePolicyTests {
537 } 534 }
538 535
539 // ============================================================ 536 // ============================================================
540 // Repository State Announcement Tests
541 // ============================================================
542
543 /// Test: Accept valid repository state announcements
544 ///
545 /// Spec: Line 7 of ../grasp/01.md
546 /// Requirement: MUST accept repo state announcements with d, maintainers, and r tags
547 ///
548 /// **EXAMPLE: Using TestContext pattern for fixture management**
549 /// This test demonstrates the new TestContext pattern:
550 /// - In CI mode: Creates fresh repo for full isolation
551 /// - In Production mode: Reuses cached repo to minimize events
552 pub async fn test_accept_valid_repo_state_announcement(client: &AuditClient) -> TestResult {
553 TestResult::new(
554 "accept_valid_repo_state_announcement",
555 "GRASP-01:nostr-relay:7",
556 "Accept valid state announcements after repo announcement accepted",
557 )
558 .run(|| async {
559 // Create TestContext for mode-aware fixture management
560 let ctx = TestContext::new(client);
561
562 // Use OwnerStateDataPushed which handles the complete flow:
563 // 1. Creates repo announcement
564 // 2. Pushes git data with the deterministic commit
565 // 3. Sends the state announcement
566 // This ensures the state event references a commit that actually exists
567 let state_event = ctx
568 .get_fixture(FixtureKind::OwnerStateDataPushed)
569 .await
570 .map_err(|e| {
571 format!(
572 "Test setup failed: could not get repository state fixture: {}",
573 e
574 )
575 })?;
576
577 // Extract repo_id from the state event
578 let repo_id = state_event
579 .tags
580 .iter()
581 .find(|t| t.kind() == TagKind::d())
582 .and_then(|t| t.content())
583 .ok_or("Missing d tag in state announcement")?
584 .to_string();
585
586 let event_id = state_event.id;
587
588 // Query back to verify it was accepted and stored
589 let filter = Filter::new()
590 .kind(Kind::Custom(30618))
591 .author(client.public_key())
592 .identifier(&repo_id);
593
594 let events = client
595 .query(filter)
596 .await
597 .map_err(|e| format!("Failed to query events from relay: {}", e))?;
598
599 // Verify we got the event back
600 if events.is_empty() {
601 return Err(format!(
602 "Event was not stored in relay (possibly rejected). Event ID: {}, Repo ID: {}",
603 event_id, repo_id
604 ));
605 }
606
607 Ok(())
608 })
609 .await
610 }
611
612 // ============================================================
613 // Helper Functions (6 total) 537 // Helper Functions (6 total)
614 // ============================================================ 538 // ============================================================
615 539