MCPcopy Index your code
hub / github.com/google/go-github / TestProjectsService_AddOrganizationProjectItem

Function TestProjectsService_AddOrganizationProjectItem

github/projects_test.go:798–820  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

796}
797
798func 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
822func TestProjectsService_AddProjectItemForOrg_error(t *testing.T) {
823 t.Parallel()

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
ProjectV2ItemContentTypeTypeAlias · 0.85
setupFunction · 0.70
PtrFunction · 0.70
GetIDMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…