Skip to content

Commit

Permalink
Add create fork options test
Browse files Browse the repository at this point in the history
  • Loading branch information
valbeat committed Aug 31, 2022
1 parent a49f477 commit 47ba7fc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions github/repos_forks_test.go
Expand Up @@ -73,11 +73,11 @@ func TestRepositoriesService_CreateFork(t *testing.T) {

mux.HandleFunc("/repos/o/r/forks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testFormValues(t, r, values{"organization": "o"})
testFormValues(t, r, values{"organization": "o", "name": "n", "default_branch_only": "true"})
fmt.Fprint(w, `{"id":1}`)
})

opt := &RepositoryCreateForkOptions{Organization: "o"}
opt := &RepositoryCreateForkOptions{Organization: "o", Name: "n", DefaultBranchOnly: true}
ctx := context.Background()
repo, _, err := client.Repositories.CreateFork(ctx, "o", "r", opt)
if err != nil {
Expand Down Expand Up @@ -110,13 +110,13 @@ func TestRepositoriesService_CreateFork_deferred(t *testing.T) {

mux.HandleFunc("/repos/o/r/forks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testFormValues(t, r, values{"organization": "o"})
testFormValues(t, r, values{"organization": "o", "name": "n", "default_branch_only": "true"})
// This response indicates the fork will happen asynchronously.
w.WriteHeader(http.StatusAccepted)
fmt.Fprint(w, `{"id":1}`)
})

opt := &RepositoryCreateForkOptions{Organization: "o"}
opt := &RepositoryCreateForkOptions{Organization: "o", Name: "n", DefaultBranchOnly: true}
ctx := context.Background()
repo, _, err := client.Repositories.CreateFork(ctx, "o", "r", opt)
if _, ok := err.(*AcceptedError); !ok {
Expand Down

0 comments on commit 47ba7fc

Please sign in to comment.