diff options
Diffstat (limited to 'grasp-audit/src/fixtures.rs')
| -rw-r--r-- | grasp-audit/src/fixtures.rs | 34 |
1 files changed, 17 insertions, 17 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 | /// |