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

Function TestMigrationService_ListUserMigrations

github/migrations_user_test.go:55–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestMigrationService_ListUserMigrations(t *testing.T) {
56 t.Parallel()
57 client, mux, _ := setup(t)
58
59 mux.HandleFunc("/user/migrations", func(w http.ResponseWriter, r *http.Request) {
60 testMethod(t, r, "GET")
61 testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
62
63 w.WriteHeader(http.StatusOK)
64 assertWrite(t, w, fmt.Appendf(nil, "[%s]", userMigrationJSON))
65 })
66
67 ctx := t.Context()
68 got, _, err := client.Migrations.ListUserMigrations(ctx, &ListOptions{Page: 1, PerPage: 2})
69 if err != nil {
70 t.Errorf("ListUserMigrations returned error %v", err)
71 }
72
73 want := []*UserMigration{wantUserMigration}
74 if !cmp.Equal(want, got) {
75 t.Errorf("ListUserMigrations = %v, want = %v", got, want)
76 }
77
78 const methodName = "ListUserMigrations"
79 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
80 got, resp, err := client.Migrations.ListUserMigrations(ctx, &ListOptions{Page: 1, PerPage: 2})
81 if got != nil {
82 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
83 }
84 return resp, err
85 })
86}
87
88func TestMigrationService_UserMigrationStatus(t *testing.T) {
89 t.Parallel()

Callers

nothing calls this directly

Calls 7

testMethodFunction · 0.85
testHeaderFunction · 0.85
assertWriteFunction · 0.85
ListUserMigrationsMethod · 0.80
EqualMethod · 0.80
setupFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…