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

Function TestMigrationService_StartUserMigration

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

Source from the content-addressed store, hash-verified

15)
16
17func TestMigrationService_StartUserMigration(t *testing.T) {
18 t.Parallel()
19 client, mux, _ := setup(t)
20
21 mux.HandleFunc("/user/migrations", func(w http.ResponseWriter, r *http.Request) {
22 testMethod(t, r, "POST")
23 testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
24
25 w.WriteHeader(http.StatusCreated)
26 assertWrite(t, w, userMigrationJSON)
27 })
28
29 opt := &UserMigrationOptions{
30 LockRepositories: true,
31 ExcludeAttachments: false,
32 }
33
34 ctx := t.Context()
35 got, _, err := client.Migrations.StartUserMigration(ctx, []string{"r"}, opt)
36 if err != nil {
37 t.Errorf("StartUserMigration returned error: %v", err)
38 }
39
40 want := wantUserMigration
41 if !cmp.Equal(want, got) {
42 t.Errorf("StartUserMigration = %v, want = %v", got, want)
43 }
44
45 const methodName = "StartUserMigration"
46 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
47 got, resp, err := client.Migrations.StartUserMigration(ctx, []string{"r"}, opt)
48 if got != nil {
49 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
50 }
51 return resp, err
52 })
53}
54
55func TestMigrationService_ListUserMigrations(t *testing.T) {
56 t.Parallel()

Callers

nothing calls this directly

Calls 7

testMethodFunction · 0.85
testHeaderFunction · 0.85
assertWriteFunction · 0.85
StartUserMigrationMethod · 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…