Skip to content

Commit

Permalink
Adding tests to orgs().secrets().create_or_update_secret() (XAMPPRo…
Browse files Browse the repository at this point in the history
…cky#590)

- Added 204 case
  • Loading branch information
manchicken authored and dmgorsky committed Mar 6, 2024
1 parent 2f83d8b commit 473c061
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/org_secrets_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,30 @@ async fn should_add_secret() {
let item = result.unwrap();
assert_eq!(item, CreateOrganizationSecretResponse::Created);
}

#[tokio::test]
async fn should_add_secret_204() {
let template = ResponseTemplate::new(204);
let mock_server = setup_put_api(template, "/GH_TOKEN").await;
let client = setup_octocrab(&mock_server.uri());
let org = client.orgs(ORG.to_owned());
let secrets = org.secrets();
let result = secrets
.create_or_update_secret(
"GH_TOKEN",
&CreateOrganizationSecret {
key_id: "123456",
encrypted_value: "some-b64-string",
visibility: Visibility::Selected,
selected_repository_ids: None,
},
)
.await;
assert!(
result.is_ok(),
"expected successful result, got error: {:#?}",
result
);
let item = result.unwrap();
assert_eq!(item, CreateOrganizationSecretResponse::Updated);
}

0 comments on commit 473c061

Please sign in to comment.