(t *testing.T)
| 1070 | } |
| 1071 | |
| 1072 | func TestProjectsService_AddUserProjectItem(t *testing.T) { |
| 1073 | t.Parallel() |
| 1074 | client, mux, _ := setup(t) |
| 1075 | mux.HandleFunc("/users/u/projectsV2/2/items", func(w http.ResponseWriter, r *http.Request) { |
| 1076 | testMethod(t, r, "POST") |
| 1077 | b, _ := io.ReadAll(r.Body) |
| 1078 | body := string(b) |
| 1079 | if body != `{"type":"PullRequest","id":123}`+"\n" { |
| 1080 | t.Fatalf("unexpected body: %s", body) |
| 1081 | } |
| 1082 | fmt.Fprint(w, `{"id":123,"node_id":"PVTI_new_user"}`) |
| 1083 | }) |
| 1084 | ctx := t.Context() |
| 1085 | item, _, err := client.Projects.AddUserProjectItem(ctx, "u", 2, &AddProjectItemOptions{Type: Ptr(ProjectV2ItemContentType("PullRequest")), ID: Ptr(int64(123))}) |
| 1086 | if err != nil { |
| 1087 | t.Fatalf("AddUserProjectItem error: %v", err) |
| 1088 | } |
| 1089 | if item.GetID() != 123 { |
| 1090 | t.Fatalf("unexpected item: %+v", item) |
| 1091 | } |
| 1092 | } |
| 1093 | |
| 1094 | func TestProjectsService_AddUserProjectItem_error(t *testing.T) { |
| 1095 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…