You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
c.repository_owner_id = 999;// Different from OWNER_ID (42)
388
+
})
389
+
.await?;
334
390
335
391
let body = default_claims().as_exchange_body()?;
336
392
let response = client.post::<()>(URL, body).await;
337
393
assert_snapshot!(response.status(), @"400 Bad Request");
338
-
assert_snapshot!(response.json(), @r#"{"errors":[{"detail":"The Trusted Publishing config for repository `rust-lang/foo-rs` requires an environment, but the JWT does not specify one. Expected environments: `prod`"}]}"#);
394
+
assert_snapshot!(response.json(), @r#"{"errors":[{"detail":"The Trusted Publishing config for repository `rust-lang/foo-rs` does not match the repository owner ID (42) in the JWT. Expected owner IDs: 999. Please recreate the Trusted Publishing config to update the repository owner ID."}]}"#);
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`"}]}"#);
let client = prepare_with_config(|c| c.environment = Some("prod")).await?;
425
+
426
+
let body = default_claims().as_exchange_body()?;
351
427
let response = client.post::<()>(URL, body).await;
352
428
assert_snapshot!(response.status(), @"400 Bad Request");
353
-
assert_snapshot!(response.json(), @r#"{"errors":[{"detail":"The Trusted Publishing config for repository `rust-lang/foo-rs` does not match the environment `not-prod` in the JWT. Expected environments: `prod`"}]}"#);
429
+
assert_snapshot!(response.json(), @r#"{"errors":[{"detail":"The Trusted Publishing config for repository `rust-lang/foo-rs` requires an environment, but the JWT does not specify one. Expected environments: `prod`"}]}"#);
354
430
355
431
Ok(())
356
432
}
357
433
358
-
/// Check that the owner name, repository name, and environment are accepted in
let client = prepare_with_config(|c| c.environment = Some("prod")).await?;
363
437
364
-
let claims = FullGitHubClaims::builder()
365
-
.owner_id(OWNER_ID)
366
-
.owner_name("RUST-lanG")
367
-
.repository_name("foo-RS")
368
-
.workflow_filename(WORKFLOW_FILENAME)
369
-
.environment("PROD")
370
-
.build();
438
+
letmut claims = default_claims();
439
+
claims.environment = Some("not-prod".into());
371
440
372
441
let body = claims.as_exchange_body()?;
373
442
let response = client.post::<()>(URL, body).await;
374
-
assert_snapshot!(response.status(), @"200 OK");
443
+
assert_snapshot!(response.status(), @"400 Bad Request");
444
+
assert_snapshot!(response.json(), @r#"{"errors":[{"detail":"The Trusted Publishing config for repository `rust-lang/foo-rs` does not match the environment `not-prod` in the JWT. Expected environments: `prod`"}]}"#);
0 commit comments