MCPcopy Create free account
hub / github.com/auth0/auth0-cli / TestRemoveLocalCallbackURLToClient

Function TestRemoveLocalCallbackURLToClient

internal/cli/utils_shared_test.go:258–342  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

256}
257
258func 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) {

Callers

nothing calls this directly

Calls 5

EXPECTMethod · 0.95
NewMockClientAPIFunction · 0.92
UpdateMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected