Skip to content

Commit

Permalink
Update DependabotSecretsSelectedRepoIDs type to []int64 (#2794)
Browse files Browse the repository at this point in the history
  • Loading branch information
jburandt authored Jun 5, 2023
1 parent d6880db commit bc019ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion github/dependabot_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (s *DependabotService) ListSelectedReposForOrgSecret(ctx context.Context, o
}

// DependabotSecretsSelectedRepoIDs are the repository IDs that have access to the dependabot secrets.
type DependabotSecretsSelectedRepoIDs []string
type DependabotSecretsSelectedRepoIDs []int64

// SetSelectedReposForOrgSecret sets the repositories that have access to a Dependabot secret.
//
Expand Down
12 changes: 6 additions & 6 deletions github/dependabot_secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func TestDependabotService_CreateOrUpdateOrgSecret(t *testing.T) {
mux.HandleFunc("/orgs/o/dependabot/secrets/NAME", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
testHeader(t, r, "Content-Type", "application/json")
testBody(t, r, `{"key_id":"1234","encrypted_value":"QIv=","visibility":"selected","selected_repository_ids":["1296269","1269280"]}`+"\n")
testBody(t, r, `{"key_id":"1234","encrypted_value":"QIv=","visibility":"selected","selected_repository_ids":[1296269,1269280]}`+"\n")
w.WriteHeader(http.StatusCreated)
})

Expand All @@ -361,7 +361,7 @@ func TestDependabotService_CreateOrUpdateOrgSecret(t *testing.T) {
EncryptedValue: "QIv=",
KeyID: "1234",
Visibility: "selected",
SelectedRepositoryIDs: DependabotSecretsSelectedRepoIDs{"1296269", "1269280"},
SelectedRepositoryIDs: DependabotSecretsSelectedRepoIDs{1296269, 1269280},
}
ctx := context.Background()
_, err := client.Dependabot.CreateOrUpdateOrgSecret(ctx, "o", input)
Expand Down Expand Up @@ -428,23 +428,23 @@ func TestDependabotService_SetSelectedReposForOrgSecret(t *testing.T) {
mux.HandleFunc("/orgs/o/dependabot/secrets/NAME/repositories", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
testHeader(t, r, "Content-Type", "application/json")
testBody(t, r, `{"selected_repository_ids":["64780797"]}`+"\n")
testBody(t, r, `{"selected_repository_ids":[64780797]}`+"\n")
})

ctx := context.Background()
_, err := client.Dependabot.SetSelectedReposForOrgSecret(ctx, "o", "NAME", DependabotSecretsSelectedRepoIDs{"64780797"})
_, err := client.Dependabot.SetSelectedReposForOrgSecret(ctx, "o", "NAME", DependabotSecretsSelectedRepoIDs{64780797})
if err != nil {
t.Errorf("Dependabot.SetSelectedReposForOrgSecret returned error: %v", err)
}

const methodName = "SetSelectedReposForOrgSecret"
testBadOptions(t, methodName, func() (err error) {
_, err = client.Dependabot.SetSelectedReposForOrgSecret(ctx, "\n", "\n", DependabotSecretsSelectedRepoIDs{"64780797"})
_, err = client.Dependabot.SetSelectedReposForOrgSecret(ctx, "\n", "\n", DependabotSecretsSelectedRepoIDs{64780797})
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Dependabot.SetSelectedReposForOrgSecret(ctx, "o", "NAME", DependabotSecretsSelectedRepoIDs{"64780797"})
return client.Dependabot.SetSelectedReposForOrgSecret(ctx, "o", "NAME", DependabotSecretsSelectedRepoIDs{64780797})
})
}

Expand Down

0 comments on commit bc019ca

Please sign in to comment.