upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--grasp-audit/src/fixtures.rs34
-rw-r--r--grasp-audit/src/specs/grasp01/nip01_smoke.rs14
-rw-r--r--grasp-audit/src/specs/grasp01/push_authorization.rs8
3 files changed, 28 insertions, 28 deletions
diff --git a/grasp-audit/src/fixtures.rs b/grasp-audit/src/fixtures.rs
index 8a51d77..9a00aef 100644
--- a/grasp-audit/src/fixtures.rs
+++ b/grasp-audit/src/fixtures.rs
@@ -140,7 +140,7 @@ pub enum FixtureKind {
140 ValidRepoServed, 140 ValidRepoServed,
141 141
142 /// Repository with one issue (kind 1621) 142 /// Repository with one issue (kind 1621)
143 /// - Requires ValidRepoSent (reuses same repo_id) 143 /// - Requires ValidRepoServed (needs queryable repo for issue to reference)
144 RepoWithIssue, 144 RepoWithIssue,
145 145
146 /// Repository with issue and comment (kind 1111) 146 /// Repository with issue and comment (kind 1111)
@@ -154,8 +154,8 @@ pub enum FixtureKind {
154 /// - Timestamp: 10 seconds in the past 154 /// - Timestamp: 10 seconds in the past
155 RepoState, 155 RepoState,
156 156
157 /// PR (Pull Request) event for the SAME repo_id as ValidRepoSent 157 /// PR (Pull Request) event for the SAME repo_id as ValidRepoServed
158 /// - Requires ValidRepoSent (uses same repo_id) 158 /// - Requires ValidRepoServed (uses same repo_id, needs queryable repo)
159 /// - Signed by `client.pr_author_keys()` 159 /// - Signed by `client.pr_author_keys()`
160 /// - Kind 1618 (NIP-34 PR) 160 /// - Kind 1618 (NIP-34 PR)
161 /// - Includes `a` tag referencing the repo 161 /// - Includes `a` tag referencing the repo
@@ -168,7 +168,7 @@ pub enum FixtureKind {
168 /// This is a "Generated" stage fixture - the event is created but not published. 168 /// This is a "Generated" stage fixture - the event is created but not published.
169 /// Useful for tests that need the PR event ID before the event exists on the relay. 169 /// Useful for tests that need the PR event ID before the event exists on the relay.
170 /// 170 ///
171 /// - Requires ValidRepoSent (uses same repo_id) 171 /// - Requires ValidRepoServed (uses same repo_id, needs queryable repo)
172 /// - Signed by `client.pr_author_keys()` 172 /// - Signed by `client.pr_author_keys()`
173 /// - Kind 1618 (NIP-34 PR) 173 /// - Kind 1618 (NIP-34 PR)
174 /// - Includes `c` tag pointing to PR_TEST_COMMIT_HASH 174 /// - Includes `c` tag pointing to PR_TEST_COMMIT_HASH
@@ -202,7 +202,7 @@ pub enum FixtureKind {
202 /// (the "wrong" commit), but no PR event exists yet on the relay. 202 /// (the "wrong" commit), but no PR event exists yet on the relay.
203 /// 203 ///
204 /// Server state after this fixture: 204 /// Server state after this fixture:
205 /// - ValidRepoSent announcement on relay 205 /// - ValidRepoServed announcement on relay (repo is queryable)
206 /// - refs/nostr/<pr-event-id> exists on git server with wrong commit 206 /// - refs/nostr/<pr-event-id> exists on git server with wrong commit
207 /// - PR event is NOT on relay (but returned for tests to publish later) 207 /// - PR event is NOT on relay (but returned for tests to publish later)
208 /// 208 ///
@@ -218,7 +218,7 @@ pub enum FixtureKind {
218 /// then the PR event was published (which may trigger cleanup). 218 /// then the PR event was published (which may trigger cleanup).
219 /// 219 ///
220 /// Server state after this fixture: 220 /// Server state after this fixture:
221 /// - ValidRepoSent announcement on relay 221 /// - ValidRepoServed announcement on relay
222 /// - PR event is on relay 222 /// - PR event is on relay
223 /// - refs/nostr/<pr-event-id> may have been cleaned up (that's what tests verify) 223 /// - refs/nostr/<pr-event-id> may have been cleaned up (that's what tests verify)
224 /// 224 ///
@@ -343,8 +343,8 @@ impl FixtureKind {
343 // Fixtures that depend on ValidRepoServed (need queryable announcement) 343 // Fixtures that depend on ValidRepoServed (need queryable announcement)
344 Self::RepoWithIssue => vec![Self::ValidRepoServed], 344 Self::RepoWithIssue => vec![Self::ValidRepoServed],
345 Self::RepoState => vec![Self::ValidRepoSent], 345 Self::RepoState => vec![Self::ValidRepoSent],
346 Self::PREvent => vec![Self::ValidRepoSent], 346 Self::PREvent => vec![Self::ValidRepoServed],
347 Self::PREventGenerated => vec![Self::ValidRepoSent], 347 Self::PREventGenerated => vec![Self::ValidRepoServed],
348 Self::PRWrongCommitPushedBeforeEvent => vec![Self::PREventGenerated], 348 Self::PRWrongCommitPushedBeforeEvent => vec![Self::PREventGenerated],
349 Self::PREventSentAfterWrongPush => vec![Self::PRWrongCommitPushedBeforeEvent], 349 Self::PREventSentAfterWrongPush => vec![Self::PRWrongCommitPushedBeforeEvent],
350 350
@@ -777,15 +777,15 @@ impl<'a> TestContext<'a> {
777 FixtureKind::PREvent => { 777 FixtureKind::PREvent => {
778 use nostr_sdk::prelude::*; 778 use nostr_sdk::prelude::*;
779 779
780 // ValidRepoSent is ensured by ensure_fixture before this is called 780 // ValidRepoServed is ensured by ensure_fixture before this is called
781 let repo = self.get_cached_dependency(FixtureKind::ValidRepoSent)?; 781 let repo = self.get_cached_dependency(FixtureKind::ValidRepoServed)?;
782 782
783 let repo_id = repo 783 let repo_id = repo
784 .tags 784 .tags
785 .iter() 785 .iter()
786 .find(|t| t.kind() == TagKind::d()) 786 .find(|t| t.kind() == TagKind::d())
787 .and_then(|t| t.content()) 787 .and_then(|t| t.content())
788 .ok_or_else(|| anyhow::anyhow!("Missing repo_id in ValidRepoSent fixture"))? 788 .ok_or_else(|| anyhow::anyhow!("Missing repo_id in ValidRepoServed fixture"))?
789 .to_string(); 789 .to_string();
790 790
791 // Create PR event 1 second in the past 791 // Create PR event 1 second in the past
@@ -820,15 +820,15 @@ impl<'a> TestContext<'a> {
820 // This fixture is for "Generated" stage only 820 // This fixture is for "Generated" stage only
821 use nostr_sdk::prelude::*; 821 use nostr_sdk::prelude::*;
822 822
823 // ValidRepoSent is ensured by ensure_fixture before this is called 823 // ValidRepoServed is ensured by ensure_fixture before this is called
824 let repo = self.get_cached_dependency(FixtureKind::ValidRepoSent)?; 824 let repo = self.get_cached_dependency(FixtureKind::ValidRepoServed)?;
825 825
826 let repo_id = repo 826 let repo_id = repo
827 .tags 827 .tags
828 .iter() 828 .iter()
829 .find(|t| t.kind() == TagKind::d()) 829 .find(|t| t.kind() == TagKind::d())
830 .and_then(|t| t.content()) 830 .and_then(|t| t.content())
831 .ok_or_else(|| anyhow::anyhow!("Missing repo_id in ValidRepoSent fixture"))? 831 .ok_or_else(|| anyhow::anyhow!("Missing repo_id in ValidRepoServed fixture"))?
832 .to_string(); 832 .to_string();
833 833
834 // Create PR event 1 second in the past 834 // Create PR event 1 second in the past
@@ -1533,8 +1533,8 @@ impl<'a> TestContext<'a> {
1533 let pr_event = self.get_cached_dependency(FixtureKind::PREventGenerated)?; 1533 let pr_event = self.get_cached_dependency(FixtureKind::PREventGenerated)?;
1534 let pr_event_id = pr_event.id.to_hex(); 1534 let pr_event_id = pr_event.id.to_hex();
1535 1535
1536 // Get the ValidRepoSent to extract repo info 1536 // Get the ValidRepoServed to extract repo info
1537 let repo = self.get_cached_dependency(FixtureKind::ValidRepoSent)?; 1537 let repo = self.get_cached_dependency(FixtureKind::ValidRepoServed)?;
1538 let repo_id = self.extract_repo_id(&repo)?; 1538 let repo_id = self.extract_repo_id(&repo)?;
1539 1539
1540 // Get relay domain for cloning 1540 // Get relay domain for cloning
@@ -1613,7 +1613,7 @@ impl<'a> TestContext<'a> {
1613 /// 1613 ///
1614 /// This fixture builds on PRWrongCommitPushedBeforeEvent by sending the PR event. 1614 /// This fixture builds on PRWrongCommitPushedBeforeEvent by sending the PR event.
1615 /// After this fixture, the relay has: 1615 /// After this fixture, the relay has:
1616 /// - ValidRepoSent announcement 1616 /// - ValidRepoServed announcement
1617 /// - PR event 1617 /// - PR event
1618 /// - refs/nostr/<pr-event-id> may have been cleaned up (that's what tests verify) 1618 /// - refs/nostr/<pr-event-id> may have been cleaned up (that's what tests verify)
1619 /// 1619 ///
diff --git a/grasp-audit/src/specs/grasp01/nip01_smoke.rs b/grasp-audit/src/specs/grasp01/nip01_smoke.rs
index 8cb4166..e3206fc 100644
--- a/grasp-audit/src/specs/grasp01/nip01_smoke.rs
+++ b/grasp-audit/src/specs/grasp01/nip01_smoke.rs
@@ -66,12 +66,12 @@ impl Nip01SmokeTests {
66 "MUST accept valid EVENT messages", 66 "MUST accept valid EVENT messages",
67 ) 67 )
68 .run(|| async { 68 .run(|| async {
69 // Step 1: GENERATE - Create TestContext and get ValidRepo fixture 69 // Step 1: GENERATE - Create TestContext and get ValidRepoServed fixture
70 let ctx = TestContext::new(client); 70 let ctx = TestContext::new(client);
71 let event = ctx 71 let event = ctx
72 .get_fixture(FixtureKind::ValidRepoSent) 72 .get_fixture(FixtureKind::ValidRepoServed)
73 .await 73 .await
74 .map_err(|e| format!("Failed to create ValidRepo fixture: {}", e))?; 74 .map_err(|e| format!("Failed to create ValidRepoServed fixture: {}", e))?;
75 75
76 let event_id = event.id; 76 let event_id = event.id;
77 77
@@ -122,7 +122,7 @@ impl Nip01SmokeTests {
122 /// 122 ///
123 /// ## Fixture-First Pattern 123 /// ## Fixture-First Pattern
124 /// 124 ///
125 /// 1. **Generate**: Create TestContext and get ValidRepo fixture 125 /// 1. **Generate**: Create TestContext and get ValidRepoServed fixture
126 /// 2. **Send**: Fixture already sends the event to relay 126 /// 2. **Send**: Fixture already sends the event to relay
127 /// 3. **Verify**: Subscribe and verify we receive the event 127 /// 3. **Verify**: Subscribe and verify we receive the event
128 pub async fn test_create_subscription(client: &AuditClient) -> TestResult { 128 pub async fn test_create_subscription(client: &AuditClient) -> TestResult {
@@ -132,12 +132,12 @@ impl Nip01SmokeTests {
132 "MUST support REQ subscriptions", 132 "MUST support REQ subscriptions",
133 ) 133 )
134 .run(|| async { 134 .run(|| async {
135 // Step 1: GENERATE - Create TestContext and get ValidRepo fixture 135 // Step 1: GENERATE - Create TestContext and get ValidRepoServed fixture
136 let ctx = TestContext::new(client); 136 let ctx = TestContext::new(client);
137 let _event = ctx 137 let _event = ctx
138 .get_fixture(FixtureKind::ValidRepoSent) 138 .get_fixture(FixtureKind::ValidRepoServed)
139 .await 139 .await
140 .map_err(|e| format!("Failed to create ValidRepo fixture: {}", e))?; 140 .map_err(|e| format!("Failed to create ValidRepoServed fixture: {}", e))?;
141 141
142 // Step 2: VERIFY - Subscribe to NIP-34 announcements from this author 142 // Step 2: VERIFY - Subscribe to NIP-34 announcements from this author
143 let filter = Filter::new() 143 let filter = Filter::new()
diff --git a/grasp-audit/src/specs/grasp01/push_authorization.rs b/grasp-audit/src/specs/grasp01/push_authorization.rs
index dc78b49..768e8f9 100644
--- a/grasp-audit/src/specs/grasp01/push_authorization.rs
+++ b/grasp-audit/src/specs/grasp01/push_authorization.rs
@@ -208,7 +208,7 @@ async fn setup_pr_test_repo(
208) -> Result<(PathBuf, String, String, String), String> { 208) -> Result<(PathBuf, String, String, String), String> {
209 // Get fixtures 209 // Get fixtures
210 let repo_event = ctx 210 let repo_event = ctx
211 .get_fixture(FixtureKind::ValidRepoSent) 211 .get_fixture(FixtureKind::ValidRepoServed)
212 .await 212 .await
213 .map_err(|e| format!("Failed to get repo announcement: {}", e))?; 213 .map_err(|e| format!("Failed to get repo announcement: {}", e))?;
214 214
@@ -1110,7 +1110,7 @@ impl PushAuthorizationTests {
1110 let pr_event_id = pr_event.id.to_hex(); 1110 let pr_event_id = pr_event.id.to_hex();
1111 1111
1112 // Get repo info for cloning (fresh clone for verification) 1112 // Get repo info for cloning (fresh clone for verification)
1113 let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { 1113 let repo = match ctx.get_fixture(FixtureKind::ValidRepoServed).await {
1114 Ok(r) => r, 1114 Ok(r) => r,
1115 Err(e) => { 1115 Err(e) => {
1116 return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc) 1116 return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc)
@@ -1198,7 +1198,7 @@ impl PushAuthorizationTests {
1198 let pr_event_id = pr_event.id.to_hex(); 1198 let pr_event_id = pr_event.id.to_hex();
1199 1199
1200 // Get repo info for cloning (fresh clone for this test) 1200 // Get repo info for cloning (fresh clone for this test)
1201 let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { 1201 let repo = match ctx.get_fixture(FixtureKind::ValidRepoServed).await {
1202 Ok(r) => r, 1202 Ok(r) => r,
1203 Err(e) => { 1203 Err(e) => {
1204 return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc) 1204 return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc)
@@ -1289,7 +1289,7 @@ impl PushAuthorizationTests {
1289 let pr_event_id = pr_event.id.to_hex(); 1289 let pr_event_id = pr_event.id.to_hex();
1290 1290
1291 // Get repo info for cloning (fresh clone for this test) 1291 // Get repo info for cloning (fresh clone for this test)
1292 let repo = match ctx.get_fixture(FixtureKind::ValidRepoSent).await { 1292 let repo = match ctx.get_fixture(FixtureKind::ValidRepoServed).await {
1293 Ok(r) => r, 1293 Ok(r) => r,
1294 Err(e) => { 1294 Err(e) => {
1295 return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc) 1295 return TestResult::new(test_name, SpecRef::GitAcceptRefsNostrEventId, desc)