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

Function TestProjectsService_GetUserProject

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

Source from the content-addressed store, hash-verified

139}
140
141func TestProjectsService_GetUserProject(t *testing.T) {
142 t.Parallel()
143 client, mux, _ := setup(t)
144
145 mux.HandleFunc("/users/u/projectsV2/3", func(w http.ResponseWriter, r *http.Request) {
146 testMethod(t, r, "GET")
147 fmt.Fprint(w, `{"id":3,"title":"UserProj","created_at":"2011-01-02T15:04:05Z","updated_at":"2012-01-02T15:04:05Z"}`)
148 })
149
150 ctx := t.Context()
151 project, _, err := client.Projects.GetUserProject(ctx, "u", 3)
152 if err != nil {
153 t.Fatalf("Projects.GetUserProject returned error: %v", err)
154 }
155 if project.GetID() != 3 || project.GetTitle() != "UserProj" {
156 t.Fatalf("Projects.GetUserProject returned %+v", project)
157 }
158
159 const methodName = "GetUserProject"
160 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
161 got, resp, err := client.Projects.GetUserProject(ctx, "u", 3)
162 if got != nil {
163 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
164 }
165 return resp, err
166 })
167}
168
169func TestProjectsService_ListOrganizationProjectFields(t *testing.T) {
170 t.Parallel()

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
GetUserProjectMethod · 0.80
setupFunction · 0.70
GetIDMethod · 0.45
GetTitleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…