Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DependabotSecretsSelectedRepoIDs type to []int64 #2794

Merged
merged 2 commits into from Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion github/dependabot_secrets.go
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
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