Skip to content

Commit bc129f4

Browse files
committed
trustpub/tokens/exchange: Add workflow_filename mismatch test
1 parent dc9f72e commit bc129f4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/controllers/trustpub/tokens/exchange/github_tests.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,25 @@ async fn test_repository_owner_id_mismatch() -> anyhow::Result<()> {
396396
Ok(())
397397
}
398398

399+
// ============================================================================
400+
// Workflow filename matching tests
401+
// ============================================================================
402+
403+
#[tokio::test(flavor = "multi_thread")]
404+
async fn test_workflow_filename_mismatch() -> anyhow::Result<()> {
405+
let client = prepare_with_config(|c| {
406+
c.workflow_filename = "different.yml";
407+
})
408+
.await?;
409+
410+
let body = default_claims().as_exchange_body()?;
411+
let response = client.post::<()>(URL, body).await;
412+
assert_snapshot!(response.status(), @"400 Bad Request");
413+
assert_snapshot!(response.json(), @r#"{"errors":[{"detail":"The Trusted Publishing config for repository `rust-lang/foo-rs` does not match the workflow filename `publish.yml` in the JWT. Expected workflow filenames: `different.yml`"}]}"#);
414+
415+
Ok(())
416+
}
417+
399418
// ============================================================================
400419
// Environment matching tests
401420
// ============================================================================

0 commit comments

Comments
 (0)