(t *testing.T)
| 256 | } |
| 257 | |
| 258 | func TestRemoveLocalCallbackURLToClient(t *testing.T) { |
| 259 | tests := []struct { |
| 260 | name string |
| 261 | intialClient *management.Client |
| 262 | finalClient *management.Client |
| 263 | apiError error |
| 264 | assertError func(t testing.TB, err error) |
| 265 | }{ |
| 266 | { |
| 267 | name: "removes the callback", |
| 268 | intialClient: &management.Client{ |
| 269 | ClientID: auth0.String(""), |
| 270 | Callbacks: &[]string{ |
| 271 | "http://localhost:3000", |
| 272 | cliLoginTestingCallbackURL, |
| 273 | }, |
| 274 | }, |
| 275 | finalClient: &management.Client{ |
| 276 | Callbacks: &[]string{"http://localhost:3000"}, |
| 277 | }, |
| 278 | assertError: func(t testing.TB, err error) { |
| 279 | assert.Nil(t, err) |
| 280 | }, |
| 281 | }, |
| 282 | { |
| 283 | name: "does not remove the callback when not present", |
| 284 | intialClient: &management.Client{ |
| 285 | ClientID: auth0.String(""), |
| 286 | Callbacks: &[]string{"http://localhost:3000"}, |
| 287 | }, |
| 288 | assertError: func(t testing.TB, err error) { |
| 289 | assert.Nil(t, err) |
| 290 | }, |
| 291 | }, |
| 292 | { |
| 293 | name: "does not remove the callback when there are no other callbacks", |
| 294 | intialClient: &management.Client{ |
| 295 | ClientID: auth0.String(""), |
| 296 | Callbacks: &[]string{cliLoginTestingCallbackURL}, |
| 297 | }, |
| 298 | assertError: func(t testing.TB, err error) { |
| 299 | assert.Nil(t, err) |
| 300 | }, |
| 301 | }, |
| 302 | { |
| 303 | name: "returns the API error", |
| 304 | intialClient: &management.Client{ |
| 305 | ClientID: auth0.String(""), |
| 306 | Callbacks: &[]string{ |
| 307 | "http://localhost:3000", |
| 308 | cliLoginTestingCallbackURL, |
| 309 | }, |
| 310 | }, |
| 311 | finalClient: &management.Client{ |
| 312 | Callbacks: &[]string{"http://localhost:3000"}, |
| 313 | }, |
| 314 | apiError: errors.New("error"), |
| 315 | assertError: func(t testing.TB, err error) { |
nothing calls this directly
no test coverage detected