diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-28 01:44:58 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-28 01:44:58 +0000 |
| commit | f053827e0a157f348d9cf834f026a8de322abfe2 (patch) | |
| tree | 4dcde0f1e92dfe26fde131ef0f3f35e677e56b5b /grasp-audit/src/specs | |
| parent | 0c1d60a2ad69e79e83d36ed8a001743fde3d6666 (diff) | |
grasp-audit run all tests in audit mode
Diffstat (limited to 'grasp-audit/src/specs')
| -rw-r--r-- | grasp-audit/src/specs/grasp01/git_clone.rs | 14 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/mod.rs | 14 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/push_authorization.rs | 16 | ||||
| -rw-r--r-- | grasp-audit/src/specs/grasp01/repository_creation.rs | 14 | ||||
| -rw-r--r-- | grasp-audit/src/specs/mod.rs | 7 |
5 files changed, 63 insertions, 2 deletions
diff --git a/grasp-audit/src/specs/grasp01/git_clone.rs b/grasp-audit/src/specs/grasp01/git_clone.rs index da60f26..8c91c04 100644 --- a/grasp-audit/src/specs/grasp01/git_clone.rs +++ b/grasp-audit/src/specs/grasp01/git_clone.rs | |||
| @@ -24,6 +24,20 @@ use std::process::Command; | |||
| 24 | pub struct GitCloneTests; | 24 | pub struct GitCloneTests; |
| 25 | 25 | ||
| 26 | impl GitCloneTests { | 26 | impl GitCloneTests { |
| 27 | /// Run all Git clone tests | ||
| 28 | pub async fn run_all( | ||
| 29 | client: &AuditClient, | ||
| 30 | git_data_dir: &Path, | ||
| 31 | relay_domain: &str, | ||
| 32 | ) -> crate::AuditResult { | ||
| 33 | let mut results = crate::AuditResult::new("GRASP-01 Git Clone Tests"); | ||
| 34 | |||
| 35 | results.add(Self::test_basic_git_clone(client, git_data_dir, relay_domain).await); | ||
| 36 | results.add(Self::test_clone_url_format(client, git_data_dir, relay_domain).await); | ||
| 37 | |||
| 38 | results | ||
| 39 | } | ||
| 40 | |||
| 27 | /// Test that a repository can be cloned via Git HTTP backend | 41 | /// Test that a repository can be cloned via Git HTTP backend |
| 28 | /// | 42 | /// |
| 29 | /// This test: | 43 | /// This test: |
diff --git a/grasp-audit/src/specs/grasp01/mod.rs b/grasp-audit/src/specs/grasp01/mod.rs index 0d0bd9c..b5471d1 100644 --- a/grasp-audit/src/specs/grasp01/mod.rs +++ b/grasp-audit/src/specs/grasp01/mod.rs | |||
| @@ -1,4 +1,16 @@ | |||
| 1 | //! GRASP-01 specification tests | 1 | //! GRASP-01 specification tests |
| 2 | //! | ||
| 3 | //! This module contains all test suites for GRASP-01 compliance testing. | ||
| 4 | //! | ||
| 5 | //! ## Test Suites | ||
| 6 | //! | ||
| 7 | //! - [`Nip01SmokeTests`] - Basic NIP-01 relay functionality (WebSocket-only) | ||
| 8 | //! - [`Nip11DocumentTests`] - NIP-11 relay information document (WebSocket-only) | ||
| 9 | //! - [`EventAcceptancePolicyTests`] - Event acceptance rules (WebSocket-only) | ||
| 10 | //! - [`CorsTests`] - CORS headers on Git HTTP endpoints (requires git-data-dir) | ||
| 11 | //! - [`GitCloneTests`] - Git clone operations (requires git-data-dir) | ||
| 12 | //! - [`PushAuthorizationTests`] - Push authorization (requires git-data-dir) | ||
| 13 | //! - [`RepositoryCreationTests`] - Repository creation (requires git-data-dir) | ||
| 2 | 14 | ||
| 3 | pub mod cors; | 15 | pub mod cors; |
| 4 | pub mod event_acceptance_policy; | 16 | pub mod event_acceptance_policy; |
| @@ -14,4 +26,4 @@ pub use git_clone::GitCloneTests; | |||
| 14 | pub use nip01_smoke::Nip01SmokeTests; | 26 | pub use nip01_smoke::Nip01SmokeTests; |
| 15 | pub use nip11_document::Nip11DocumentTests; | 27 | pub use nip11_document::Nip11DocumentTests; |
| 16 | pub use push_authorization::PushAuthorizationTests; | 28 | pub use push_authorization::PushAuthorizationTests; |
| 17 | pub use repository_creation::RepositoryCreationTests; | 29 | pub use repository_creation::{is_bare_repository, RepositoryCreationTests}; |
diff --git a/grasp-audit/src/specs/grasp01/push_authorization.rs b/grasp-audit/src/specs/grasp01/push_authorization.rs index fad77fb..4599ea5 100644 --- a/grasp-audit/src/specs/grasp01/push_authorization.rs +++ b/grasp-audit/src/specs/grasp01/push_authorization.rs | |||
| @@ -30,6 +30,22 @@ use std::path::Path; | |||
| 30 | pub struct PushAuthorizationTests; | 30 | pub struct PushAuthorizationTests; |
| 31 | 31 | ||
| 32 | impl PushAuthorizationTests { | 32 | impl PushAuthorizationTests { |
| 33 | /// Run all push authorization tests | ||
| 34 | pub async fn run_all( | ||
| 35 | client: &AuditClient, | ||
| 36 | git_data_dir: &Path, | ||
| 37 | relay_domain: &str, | ||
| 38 | ) -> crate::AuditResult { | ||
| 39 | let mut results = crate::AuditResult::new("GRASP-01 Push Authorization Tests"); | ||
| 40 | |||
| 41 | results.add(Self::test_push_authorized_by_owner_state(client, git_data_dir, relay_domain).await); | ||
| 42 | results.add(Self::test_push_rejected_without_state_event(client, git_data_dir, relay_domain).await); | ||
| 43 | results.add(Self::test_push_rejected_wrong_commit(client, git_data_dir, relay_domain).await); | ||
| 44 | results.add(Self::test_push_authorized_by_maintainer_state_only(client, git_data_dir, relay_domain).await); | ||
| 45 | |||
| 46 | results | ||
| 47 | } | ||
| 48 | |||
| 33 | /// Test that push is authorized when state event matches the commit | 49 | /// Test that push is authorized when state event matches the commit |
| 34 | /// | 50 | /// |
| 35 | /// GRASP-01: "MUST accept pushes via this service that match the latest | 51 | /// GRASP-01: "MUST accept pushes via this service that match the latest |
diff --git a/grasp-audit/src/specs/grasp01/repository_creation.rs b/grasp-audit/src/specs/grasp01/repository_creation.rs index 31ef400..2eaf32f 100644 --- a/grasp-audit/src/specs/grasp01/repository_creation.rs +++ b/grasp-audit/src/specs/grasp01/repository_creation.rs | |||
| @@ -24,6 +24,20 @@ use std::path::Path; | |||
| 24 | pub struct RepositoryCreationTests; | 24 | pub struct RepositoryCreationTests; |
| 25 | 25 | ||
| 26 | impl RepositoryCreationTests { | 26 | impl RepositoryCreationTests { |
| 27 | /// Run all repository creation tests | ||
| 28 | pub async fn run_all( | ||
| 29 | client: &AuditClient, | ||
| 30 | git_data_dir: &Path, | ||
| 31 | ) -> crate::AuditResult { | ||
| 32 | let mut results = crate::AuditResult::new("GRASP-01 Repository Creation Tests"); | ||
| 33 | |||
| 34 | results.add(Self::test_bare_repo_created_on_announcement(client, git_data_dir).await); | ||
| 35 | results.add(Self::test_repo_creation_idempotent(client, git_data_dir).await); | ||
| 36 | results.add(Self::test_bare_repo_structure(client, git_data_dir).await); | ||
| 37 | |||
| 38 | results | ||
| 39 | } | ||
| 40 | |||
| 27 | /// Test that a bare repository is created when a valid announcement is accepted | 41 | /// Test that a bare repository is created when a valid announcement is accepted |
| 28 | /// | 42 | /// |
| 29 | /// This test: | 43 | /// This test: |
diff --git a/grasp-audit/src/specs/mod.rs b/grasp-audit/src/specs/mod.rs index a502866..1444c80 100644 --- a/grasp-audit/src/specs/mod.rs +++ b/grasp-audit/src/specs/mod.rs | |||
| @@ -1,6 +1,11 @@ | |||
| 1 | //! Test specifications | 1 | //! Test specifications |
| 2 | //! | ||
| 3 | //! This module contains all GRASP specification test suites. | ||
| 2 | 4 | ||
| 3 | pub mod grasp01; | 5 | pub mod grasp01; |
| 4 | 6 | ||
| 5 | // Re-export all test structs from grasp01 module | 7 | // Re-export all test structs from grasp01 module |
| 6 | pub use grasp01::{EventAcceptancePolicyTests, Nip01SmokeTests, Nip11DocumentTests}; | 8 | pub use grasp01::{ |
| 9 | CorsTests, EventAcceptancePolicyTests, GitCloneTests, Nip01SmokeTests, Nip11DocumentTests, | ||
| 10 | PushAuthorizationTests, RepositoryCreationTests, | ||
| 11 | }; | ||