(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func 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 | |
| 55 | func TestMigrationService_ListUserMigrations(t *testing.T) { |
| 56 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…