(t *testing.T)
| 796 | } |
| 797 | |
| 798 | func TestProjectsService_AddOrganizationProjectItem(t *testing.T) { |
| 799 | t.Parallel() |
| 800 | client, mux, _ := setup(t) |
| 801 | |
| 802 | mux.HandleFunc("/orgs/o/projectsV2/1/items", func(w http.ResponseWriter, r *http.Request) { |
| 803 | testMethod(t, r, "POST") |
| 804 | b, _ := io.ReadAll(r.Body) |
| 805 | body := string(b) |
| 806 | if body != `{"type":"Issue","id":99}`+"\n" { // encoder adds newline |
| 807 | t.Fatalf("unexpected body: %s", body) |
| 808 | } |
| 809 | fmt.Fprint(w, `{"id":99,"node_id":"PVTI_new"}`) |
| 810 | }) |
| 811 | |
| 812 | ctx := t.Context() |
| 813 | item, _, err := client.Projects.AddOrganizationProjectItem(ctx, "o", 1, &AddProjectItemOptions{Type: Ptr(ProjectV2ItemContentType("Issue")), ID: Ptr(int64(99))}) |
| 814 | if err != nil { |
| 815 | t.Fatalf("Projects.AddOrganizationProjectItem returned error: %v", err) |
| 816 | } |
| 817 | if item.GetID() != 99 { |
| 818 | t.Fatalf("unexpected item: %+v", item) |
| 819 | } |
| 820 | } |
| 821 | |
| 822 | func TestProjectsService_AddProjectItemForOrg_error(t *testing.T) { |
| 823 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…