diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-02 20:54:15 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-02 21:03:24 +0000 |
| commit | 5c10ca008413744b09136618eaa85275c997704c (patch) | |
| tree | af24387d8916bdec26315a31f67bd99c39544544 /grasp-audit/src/specs/grasp01/git_clone.rs | |
| parent | c07954f44f4c03cc17d4a83b144667cbcbb226cf (diff) | |
grasp-audit: show tests under GRASP-01 line
Diffstat (limited to 'grasp-audit/src/specs/grasp01/git_clone.rs')
| -rw-r--r-- | grasp-audit/src/specs/grasp01/git_clone.rs | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/grasp-audit/src/specs/grasp01/git_clone.rs b/grasp-audit/src/specs/grasp01/git_clone.rs index 95338e4..3d81964 100644 --- a/grasp-audit/src/specs/grasp01/git_clone.rs +++ b/grasp-audit/src/specs/grasp01/git_clone.rs | |||
| @@ -37,6 +37,7 @@ impl GitCloneTests { | |||
| 37 | 37 | ||
| 38 | /// Test that a repository can be cloned via Git HTTP backend | 38 | /// Test that a repository can be cloned via Git HTTP backend |
| 39 | /// | 39 | /// |
| 40 | /// Spec: Line 28 of ../grasp/01.md | ||
| 40 | /// This test: | 41 | /// This test: |
| 41 | /// 1. Creates a repository announcement | 42 | /// 1. Creates a repository announcement |
| 42 | /// 2. Waits for repository creation | 43 | /// 2. Waits for repository creation |
| @@ -52,7 +53,7 @@ impl GitCloneTests { | |||
| 52 | Err(e) => { | 53 | Err(e) => { |
| 53 | return TestResult::new( | 54 | return TestResult::new( |
| 54 | test_name, | 55 | test_name, |
| 55 | "GRASP-01", | 56 | "GRASP-01:git-http:28", |
| 56 | "Repository must be cloneable via Git HTTP backend", | 57 | "Repository must be cloneable via Git HTTP backend", |
| 57 | ) | 58 | ) |
| 58 | .fail(format!("Failed to create repo fixture: {}", e)) | 59 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -85,7 +86,7 @@ impl GitCloneTests { | |||
| 85 | Err(e) => { | 86 | Err(e) => { |
| 86 | return TestResult::new( | 87 | return TestResult::new( |
| 87 | test_name, | 88 | test_name, |
| 88 | "GRASP-01", | 89 | "GRASP-01:git-http:28", |
| 89 | "Repository must be cloneable via Git HTTP backend", | 90 | "Repository must be cloneable via Git HTTP backend", |
| 90 | ) | 91 | ) |
| 91 | .fail(format!("Failed to convert pubkey to npub: {}", e)) | 92 | .fail(format!("Failed to convert pubkey to npub: {}", e)) |
| @@ -120,7 +121,7 @@ impl GitCloneTests { | |||
| 120 | cleanup(); | 121 | cleanup(); |
| 121 | return TestResult::new( | 122 | return TestResult::new( |
| 122 | test_name, | 123 | test_name, |
| 123 | "GRASP-01", | 124 | "GRASP-01:git-http:28", |
| 124 | "Repository must be cloneable via Git HTTP backend", | 125 | "Repository must be cloneable via Git HTTP backend", |
| 125 | ) | 126 | ) |
| 126 | .fail(format!("Failed to execute git clone: {}", e)); | 127 | .fail(format!("Failed to execute git clone: {}", e)); |
| @@ -132,7 +133,7 @@ impl GitCloneTests { | |||
| 132 | let stderr = String::from_utf8_lossy(&output.stderr); | 133 | let stderr = String::from_utf8_lossy(&output.stderr); |
| 133 | return TestResult::new( | 134 | return TestResult::new( |
| 134 | test_name, | 135 | test_name, |
| 135 | "GRASP-01", | 136 | "GRASP-01:git-http:28", |
| 136 | "Repository must be cloneable via Git HTTP backend", | 137 | "Repository must be cloneable via Git HTTP backend", |
| 137 | ) | 138 | ) |
| 138 | .fail(format!("Git clone failed: {}", stderr)); | 139 | .fail(format!("Git clone failed: {}", stderr)); |
| @@ -143,7 +144,7 @@ impl GitCloneTests { | |||
| 143 | cleanup(); | 144 | cleanup(); |
| 144 | return TestResult::new( | 145 | return TestResult::new( |
| 145 | test_name, | 146 | test_name, |
| 146 | "GRASP-01", | 147 | "GRASP-01:git-http:28", |
| 147 | "Repository must be cloneable via Git HTTP backend", | 148 | "Repository must be cloneable via Git HTTP backend", |
| 148 | ) | 149 | ) |
| 149 | .fail("Cloned repository missing .git directory"); | 150 | .fail("Cloned repository missing .git directory"); |
| @@ -152,7 +153,7 @@ impl GitCloneTests { | |||
| 152 | cleanup(); | 153 | cleanup(); |
| 153 | TestResult::new( | 154 | TestResult::new( |
| 154 | test_name, | 155 | test_name, |
| 155 | "GRASP-01", | 156 | "GRASP-01:git-http:28", |
| 156 | "Repository must be cloneable via Git HTTP backend", | 157 | "Repository must be cloneable via Git HTTP backend", |
| 157 | ) | 158 | ) |
| 158 | .pass() | 159 | .pass() |
| @@ -160,6 +161,7 @@ impl GitCloneTests { | |||
| 160 | 161 | ||
| 161 | /// Test clone URL format validation | 162 | /// Test clone URL format validation |
| 162 | /// | 163 | /// |
| 164 | /// Spec: Line 28 of ../grasp/01.md | ||
| 163 | /// This test verifies: | 165 | /// This test verifies: |
| 164 | /// 1. URLs follow the pattern http://domain/npub/identifier.git | 166 | /// 1. URLs follow the pattern http://domain/npub/identifier.git |
| 165 | /// 2. Invalid URLs are rejected properly | 167 | /// 2. Invalid URLs are rejected properly |
| @@ -173,7 +175,7 @@ impl GitCloneTests { | |||
| 173 | Err(e) => { | 175 | Err(e) => { |
| 174 | return TestResult::new( | 176 | return TestResult::new( |
| 175 | test_name, | 177 | test_name, |
| 176 | "GRASP-01", | 178 | "GRASP-01:git-http:28", |
| 177 | "Clone URL must follow correct format", | 179 | "Clone URL must follow correct format", |
| 178 | ) | 180 | ) |
| 179 | .fail(format!("Failed to create repo fixture: {}", e)) | 181 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -201,7 +203,7 @@ impl GitCloneTests { | |||
| 201 | if !valid_url.contains(&npub) { | 203 | if !valid_url.contains(&npub) { |
| 202 | return TestResult::new( | 204 | return TestResult::new( |
| 203 | test_name, | 205 | test_name, |
| 204 | "GRASP-01", | 206 | "GRASP-01:git-http:28", |
| 205 | "Clone URL must follow correct format", | 207 | "Clone URL must follow correct format", |
| 206 | ) | 208 | ) |
| 207 | .fail("URL missing npub"); | 209 | .fail("URL missing npub"); |
| @@ -210,7 +212,7 @@ impl GitCloneTests { | |||
| 210 | if !valid_url.contains(&format!("{}.git", repo_id)) { | 212 | if !valid_url.contains(&format!("{}.git", repo_id)) { |
| 211 | return TestResult::new( | 213 | return TestResult::new( |
| 212 | test_name, | 214 | test_name, |
| 213 | "GRASP-01", | 215 | "GRASP-01:git-http:28", |
| 214 | "Clone URL must follow correct format", | 216 | "Clone URL must follow correct format", |
| 215 | ) | 217 | ) |
| 216 | .fail("URL missing repository identifier"); | 218 | .fail("URL missing repository identifier"); |
| @@ -239,7 +241,7 @@ impl GitCloneTests { | |||
| 239 | if output.status.success() { | 241 | if output.status.success() { |
| 240 | return TestResult::new( | 242 | return TestResult::new( |
| 241 | test_name, | 243 | test_name, |
| 242 | "GRASP-01", | 244 | "GRASP-01:git-http:28", |
| 243 | "Clone URL must follow correct format", | 245 | "Clone URL must follow correct format", |
| 244 | ) | 246 | ) |
| 245 | .fail("Invalid URL was accepted (should have been rejected)"); | 247 | .fail("Invalid URL was accepted (should have been rejected)"); |
| @@ -247,7 +249,7 @@ impl GitCloneTests { | |||
| 247 | 249 | ||
| 248 | TestResult::new( | 250 | TestResult::new( |
| 249 | test_name, | 251 | test_name, |
| 250 | "GRASP-01", | 252 | "GRASP-01:git-http:28", |
| 251 | "Clone URL must follow correct format", | 253 | "Clone URL must follow correct format", |
| 252 | ) | 254 | ) |
| 253 | .pass() | 255 | .pass() |
| @@ -255,6 +257,7 @@ impl GitCloneTests { | |||
| 255 | 257 | ||
| 256 | /// Test that SHA1 capabilities are advertised in git-upload-pack | 258 | /// Test that SHA1 capabilities are advertised in git-upload-pack |
| 257 | /// | 259 | /// |
| 260 | /// Spec: Line 36 of ../grasp/01.md | ||
| 258 | /// GRASP-01 requires: | 261 | /// GRASP-01 requires: |
| 259 | /// "MUST include `allow-reachable-sha1-in-want` and `allow-tip-sha1-in-want` | 262 | /// "MUST include `allow-reachable-sha1-in-want` and `allow-tip-sha1-in-want` |
| 260 | /// in advertisement and serve available oids." | 263 | /// in advertisement and serve available oids." |
| @@ -275,7 +278,7 @@ impl GitCloneTests { | |||
| 275 | Err(e) => { | 278 | Err(e) => { |
| 276 | return TestResult::new( | 279 | return TestResult::new( |
| 277 | test_name, | 280 | test_name, |
| 278 | "GRASP-01", | 281 | "GRASP-01:git-http:36", |
| 279 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 282 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 280 | ) | 283 | ) |
| 281 | .fail(format!("Failed to create repo fixture: {}", e)) | 284 | .fail(format!("Failed to create repo fixture: {}", e)) |
| @@ -296,7 +299,7 @@ impl GitCloneTests { | |||
| 296 | None => { | 299 | None => { |
| 297 | return TestResult::new( | 300 | return TestResult::new( |
| 298 | test_name, | 301 | test_name, |
| 299 | "GRASP-01", | 302 | "GRASP-01:git-http:36", |
| 300 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 303 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 301 | ) | 304 | ) |
| 302 | .fail("Repository announcement missing d tag") | 305 | .fail("Repository announcement missing d tag") |
| @@ -308,7 +311,7 @@ impl GitCloneTests { | |||
| 308 | Err(e) => { | 311 | Err(e) => { |
| 309 | return TestResult::new( | 312 | return TestResult::new( |
| 310 | test_name, | 313 | test_name, |
| 311 | "GRASP-01", | 314 | "GRASP-01:git-http:36", |
| 312 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 315 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 313 | ) | 316 | ) |
| 314 | .fail(format!("Failed to convert pubkey to npub: {}", e)) | 317 | .fail(format!("Failed to convert pubkey to npub: {}", e)) |
| @@ -328,7 +331,7 @@ impl GitCloneTests { | |||
| 328 | Err(e) => { | 331 | Err(e) => { |
| 329 | return TestResult::new( | 332 | return TestResult::new( |
| 330 | test_name, | 333 | test_name, |
| 331 | "GRASP-01", | 334 | "GRASP-01:git-http:36", |
| 332 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 335 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 333 | ) | 336 | ) |
| 334 | .fail(format!("HTTP request failed: {}", e)) | 337 | .fail(format!("HTTP request failed: {}", e)) |
| @@ -338,7 +341,7 @@ impl GitCloneTests { | |||
| 338 | if !response.status().is_success() { | 341 | if !response.status().is_success() { |
| 339 | return TestResult::new( | 342 | return TestResult::new( |
| 340 | test_name, | 343 | test_name, |
| 341 | "GRASP-01", | 344 | "GRASP-01:git-http:36", |
| 342 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 345 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 343 | ) | 346 | ) |
| 344 | .fail(format!( | 347 | .fail(format!( |
| @@ -353,7 +356,7 @@ impl GitCloneTests { | |||
| 353 | Err(e) => { | 356 | Err(e) => { |
| 354 | return TestResult::new( | 357 | return TestResult::new( |
| 355 | test_name, | 358 | test_name, |
| 356 | "GRASP-01", | 359 | "GRASP-01:git-http:36", |
| 357 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 360 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 358 | ) | 361 | ) |
| 359 | .fail(format!("Failed to read response body: {}", e)) | 362 | .fail(format!("Failed to read response body: {}", e)) |
| @@ -367,7 +370,7 @@ impl GitCloneTests { | |||
| 367 | if !has_allow_reachable { | 370 | if !has_allow_reachable { |
| 368 | return TestResult::new( | 371 | return TestResult::new( |
| 369 | test_name, | 372 | test_name, |
| 370 | "GRASP-01", | 373 | "GRASP-01:git-http:36", |
| 371 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 374 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 372 | ) | 375 | ) |
| 373 | .fail("Missing capability: allow-reachable-sha1-in-want"); | 376 | .fail("Missing capability: allow-reachable-sha1-in-want"); |
| @@ -376,7 +379,7 @@ impl GitCloneTests { | |||
| 376 | if !has_allow_tip { | 379 | if !has_allow_tip { |
| 377 | return TestResult::new( | 380 | return TestResult::new( |
| 378 | test_name, | 381 | test_name, |
| 379 | "GRASP-01", | 382 | "GRASP-01:git-http:36", |
| 380 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 383 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 381 | ) | 384 | ) |
| 382 | .fail("Missing capability: allow-tip-sha1-in-want"); | 385 | .fail("Missing capability: allow-tip-sha1-in-want"); |
| @@ -384,7 +387,7 @@ impl GitCloneTests { | |||
| 384 | 387 | ||
| 385 | TestResult::new( | 388 | TestResult::new( |
| 386 | test_name, | 389 | test_name, |
| 387 | "GRASP-01", | 390 | "GRASP-01:git-http:36", |
| 388 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", | 391 | "MUST include allow-reachable-sha1-in-want and allow-tip-sha1-in-want in advertisement", |
| 389 | ) | 392 | ) |
| 390 | .pass() | 393 | .pass() |