diff options
Diffstat (limited to 'grasp-audit/src/specs/grasp01/repository_creation.rs')
| -rw-r--r-- | grasp-audit/src/specs/grasp01/repository_creation.rs | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/grasp-audit/src/specs/grasp01/repository_creation.rs b/grasp-audit/src/specs/grasp01/repository_creation.rs index 2eddb97..a702afe 100644 --- a/grasp-audit/src/specs/grasp01/repository_creation.rs +++ b/grasp-audit/src/specs/grasp01/repository_creation.rs | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | //! cd grasp-audit && nix develop -c bash test-ngit-relay.sh --mode test | 15 | //! cd grasp-audit && nix develop -c bash test-ngit-relay.sh --mode test |
| 16 | //! ``` | 16 | //! ``` |
| 17 | 17 | ||
| 18 | use crate::specs::grasp01::SpecRef; | ||
| 18 | use crate::{AuditClient, FixtureKind, TestContext, TestResult}; | 19 | use crate::{AuditClient, FixtureKind, TestContext, TestResult}; |
| 19 | use nostr_sdk::prelude::*; | 20 | use nostr_sdk::prelude::*; |
| 20 | 21 | ||
| @@ -55,7 +56,7 @@ impl RepositoryCreationTests { | |||
| 55 | Err(e) => { | 56 | Err(e) => { |
| 56 | return TestResult::new( | 57 | return TestResult::new( |
| 57 | test_name, | 58 | test_name, |
| 58 | "GRASP-01:git-http:34", | 59 | SpecRef::GitServeRepository, |
| 59 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", | 60 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", |
| 60 | ) | 61 | ) |
| 61 | .fail(format!("Failed to create repo fixture: {}", e)) | 62 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -76,7 +77,7 @@ impl RepositoryCreationTests { | |||
| 76 | None => { | 77 | None => { |
| 77 | return TestResult::new( | 78 | return TestResult::new( |
| 78 | test_name, | 79 | test_name, |
| 79 | "GRASP-01:git-http:34", | 80 | SpecRef::GitServeRepository, |
| 80 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", | 81 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", |
| 81 | ) | 82 | ) |
| 82 | .fail("Repository announcement missing d tag") | 83 | .fail("Repository announcement missing d tag") |
| @@ -88,7 +89,7 @@ impl RepositoryCreationTests { | |||
| 88 | Err(e) => { | 89 | Err(e) => { |
| 89 | return TestResult::new( | 90 | return TestResult::new( |
| 90 | test_name, | 91 | test_name, |
| 91 | "GRASP-01:git-http:34", | 92 | SpecRef::GitServeRepository, |
| 92 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", | 93 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", |
| 93 | ) | 94 | ) |
| 94 | .fail(format!("Failed to convert pubkey to npub: {}", e)) | 95 | .fail(format!("Failed to convert pubkey to npub: {}", e)) |
| @@ -99,7 +100,7 @@ impl RepositoryCreationTests { | |||
| 99 | if let Err(e) = check_repo_accessible_via_http(relay_domain, &npub, &repo_id).await { | 100 | if let Err(e) = check_repo_accessible_via_http(relay_domain, &npub, &repo_id).await { |
| 100 | return TestResult::new( | 101 | return TestResult::new( |
| 101 | test_name, | 102 | test_name, |
| 102 | "GRASP-01:git-http:34", | 103 | SpecRef::GitServeRepository, |
| 103 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", | 104 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", |
| 104 | ) | 105 | ) |
| 105 | .fail(format!("Repository not accessible via HTTP: {}", e)); | 106 | .fail(format!("Repository not accessible via HTTP: {}", e)); |
| @@ -107,7 +108,7 @@ impl RepositoryCreationTests { | |||
| 107 | 108 | ||
| 108 | TestResult::new( | 109 | TestResult::new( |
| 109 | test_name, | 110 | test_name, |
| 110 | "GRASP-01:git-http:34", | 111 | SpecRef::GitServeRepository, |
| 111 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", | 112 | "Bare repository must be created and accessible via Smart HTTP when announcement is accepted", |
| 112 | ) | 113 | ) |
| 113 | .pass() | 114 | .pass() |
| @@ -135,7 +136,7 @@ impl RepositoryCreationTests { | |||
| 135 | Err(e) => { | 136 | Err(e) => { |
| 136 | return TestResult::new( | 137 | return TestResult::new( |
| 137 | test_name, | 138 | test_name, |
| 138 | "GRASP-01:git-http:44", | 139 | SpecRef::GitServeWebpage, |
| 139 | "Relay SHOULD serve a webpage for existing repositories", | 140 | "Relay SHOULD serve a webpage for existing repositories", |
| 140 | ) | 141 | ) |
| 141 | .fail(format!("Failed to create repo fixture: {}", e)) | 142 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -156,7 +157,7 @@ impl RepositoryCreationTests { | |||
| 156 | None => { | 157 | None => { |
| 157 | return TestResult::new( | 158 | return TestResult::new( |
| 158 | test_name, | 159 | test_name, |
| 159 | "GRASP-01:git-http:44", | 160 | SpecRef::GitServeWebpage, |
| 160 | "Relay SHOULD serve a webpage for existing repositories", | 161 | "Relay SHOULD serve a webpage for existing repositories", |
| 161 | ) | 162 | ) |
| 162 | .fail("Repository announcement missing d tag") | 163 | .fail("Repository announcement missing d tag") |
| @@ -168,7 +169,7 @@ impl RepositoryCreationTests { | |||
| 168 | Err(e) => { | 169 | Err(e) => { |
| 169 | return TestResult::new( | 170 | return TestResult::new( |
| 170 | test_name, | 171 | test_name, |
| 171 | "GRASP-01:git-http:44", | 172 | SpecRef::GitServeWebpage, |
| 172 | "Relay SHOULD serve a webpage for existing repositories", | 173 | "Relay SHOULD serve a webpage for existing repositories", |
| 173 | ) | 174 | ) |
| 174 | .fail(format!("Failed to convert pubkey to npub: {}", e)) | 175 | .fail(format!("Failed to convert pubkey to npub: {}", e)) |
| @@ -179,7 +180,7 @@ impl RepositoryCreationTests { | |||
| 179 | if let Err(e) = check_webpage_served(relay_domain, &npub, &repo_id).await { | 180 | if let Err(e) = check_webpage_served(relay_domain, &npub, &repo_id).await { |
| 180 | return TestResult::new( | 181 | return TestResult::new( |
| 181 | test_name, | 182 | test_name, |
| 182 | "GRASP-01:git-http:44", | 183 | SpecRef::GitServeWebpage, |
| 183 | "Relay SHOULD serve a webpage for existing repositories", | 184 | "Relay SHOULD serve a webpage for existing repositories", |
| 184 | ) | 185 | ) |
| 185 | .fail(format!("Webpage not served: {}", e)); | 186 | .fail(format!("Webpage not served: {}", e)); |
| @@ -187,7 +188,7 @@ impl RepositoryCreationTests { | |||
| 187 | 188 | ||
| 188 | TestResult::new( | 189 | TestResult::new( |
| 189 | test_name, | 190 | test_name, |
| 190 | "GRASP-01:git-http:44", | 191 | SpecRef::GitServeWebpage, |
| 191 | "Relay SHOULD serve a webpage for existing repositories", | 192 | "Relay SHOULD serve a webpage for existing repositories", |
| 192 | ) | 193 | ) |
| 193 | .pass() | 194 | .pass() |
| @@ -214,7 +215,7 @@ impl RepositoryCreationTests { | |||
| 214 | Err(e) => { | 215 | Err(e) => { |
| 215 | return TestResult::new( | 216 | return TestResult::new( |
| 216 | test_name, | 217 | test_name, |
| 217 | "GRASP-01:git-http:44", | 218 | SpecRef::GitServeWebpage, |
| 218 | "Relay SHOULD return 404 for repositories it doesn't host", | 219 | "Relay SHOULD return 404 for repositories it doesn't host", |
| 219 | ) | 220 | ) |
| 220 | .fail(format!("Failed to create repo fixture: {}", e)) | 221 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -226,7 +227,7 @@ impl RepositoryCreationTests { | |||
| 226 | Err(e) => { | 227 | Err(e) => { |
| 227 | return TestResult::new( | 228 | return TestResult::new( |
| 228 | test_name, | 229 | test_name, |
| 229 | "GRASP-01:git-http:44", | 230 | SpecRef::GitServeWebpage, |
| 230 | "Relay SHOULD return 404 for repositories it doesn't host", | 231 | "Relay SHOULD return 404 for repositories it doesn't host", |
| 231 | ) | 232 | ) |
| 232 | .fail(format!("Failed to convert pubkey to npub: {}", e)) | 233 | .fail(format!("Failed to convert pubkey to npub: {}", e)) |
| @@ -239,7 +240,7 @@ impl RepositoryCreationTests { | |||
| 239 | if let Err(e) = check_404_for_nonexistent_repo(relay_domain, &npub, fake_repo_id).await { | 240 | if let Err(e) = check_404_for_nonexistent_repo(relay_domain, &npub, fake_repo_id).await { |
| 240 | return TestResult::new( | 241 | return TestResult::new( |
| 241 | test_name, | 242 | test_name, |
| 242 | "GRASP-01:git-http:44", | 243 | SpecRef::GitServeWebpage, |
| 243 | "Relay SHOULD return 404 for repositories it doesn't host", | 244 | "Relay SHOULD return 404 for repositories it doesn't host", |
| 244 | ) | 245 | ) |
| 245 | .fail(format!("Expected 404, got: {}", e)); | 246 | .fail(format!("Expected 404, got: {}", e)); |
| @@ -247,7 +248,7 @@ impl RepositoryCreationTests { | |||
| 247 | 248 | ||
| 248 | TestResult::new( | 249 | TestResult::new( |
| 249 | test_name, | 250 | test_name, |
| 250 | "GRASP-01:git-http:44", | 251 | SpecRef::GitServeWebpage, |
| 251 | "Relay SHOULD return 404 for repositories it doesn't host", | 252 | "Relay SHOULD return 404 for repositories it doesn't host", |
| 252 | ) | 253 | ) |
| 253 | .pass() | 254 | .pass() |