(t *testing.T)
| 180 | } |
| 181 | |
| 182 | func TestMigrationService_UnlockUserRepo(t *testing.T) { |
| 183 | t.Parallel() |
| 184 | client, mux, _ := setup(t) |
| 185 | |
| 186 | mux.HandleFunc("/user/migrations/1/repos/r/lock", func(w http.ResponseWriter, r *http.Request) { |
| 187 | testMethod(t, r, "DELETE") |
| 188 | testHeader(t, r, "Accept", mediaTypeMigrationsPreview) |
| 189 | |
| 190 | w.WriteHeader(http.StatusNoContent) |
| 191 | }) |
| 192 | |
| 193 | ctx := t.Context() |
| 194 | got, err := client.Migrations.UnlockUserRepo(ctx, 1, "r") |
| 195 | if err != nil { |
| 196 | t.Errorf("UnlockUserRepo returned error %v", err) |
| 197 | } |
| 198 | |
| 199 | if got.StatusCode != http.StatusNoContent { |
| 200 | t.Errorf("UnlockUserRepo returned status = %v, want = %v", got.StatusCode, http.StatusNoContent) |
| 201 | } |
| 202 | |
| 203 | const methodName = "UnlockUserRepo" |
| 204 | testBadOptions(t, methodName, func() (err error) { |
| 205 | _, err = client.Migrations.UnlockUserRepo(ctx, -1, "\n") |
| 206 | return err |
| 207 | }) |
| 208 | |
| 209 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 210 | return client.Migrations.UnlockUserRepo(ctx, 1, "r") |
| 211 | }) |
| 212 | } |
| 213 | |
| 214 | var userMigrationJSON = []byte(`{ |
| 215 | "id": 79, |
nothing calls this directly
no test coverage detected
searching dependent graphs…