Skip to content

Commit

Permalink
Added a test (#577)
Browse files Browse the repository at this point in the history
- Update case of `repos().secrets().create_or_update_secret()` test added
  • Loading branch information
manchicken authored Feb 15, 2024
1 parent 172d20a commit 6f1e59a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/repo_secrets_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,30 @@ async fn should_add_secret() {
assert_eq!(item, CreateRepositorySecretResponse::Created);
}

#[tokio::test]
async fn should_update_secret_204() {
let template = ResponseTemplate::new(204);
let mock_server = setup_put_api(template, "/GH_TOKEN").await;
let result = setup_octocrab(&mock_server.uri())
.repos(OWNER.to_owned(), REPO.to_owned())
.secrets()
.create_or_update_secret(
"GH_TOKEN",
&CreateRepositorySecret {
key_id: "123456",
encrypted_value: "some-b64-string",
},
)
.await;
assert!(
result.is_ok(),
"expected successful result, got error: {:#?}",
result
);
let item = result.unwrap();
assert_eq!(item, CreateRepositorySecretResponse::Updated);
}

#[tokio::test]
async fn should_delete_secret() {
let template = ResponseTemplate::new(204);
Expand Down

0 comments on commit 6f1e59a

Please sign in to comment.