MCPcopy Create free account
hub / github.com/dinofizz/diskplayer / TestNewTokenCallbackServerError

Function TestNewTokenCallbackServerError

auth_test.go:72–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestNewTokenCallbackServerError(t *testing.T) {
73 viper.Set("spotify.callback_url", "http://localhost:8732/callback")
74 viper.Set("spotify.client_id", "client_id")
75 viper.Set("spotify.client_secret", "client_secret")
76
77 ms := new(mocks.DiskplayerServer)
78
79 a, err := NewAuthenticator()
80 assert.NoError(t, err)
81
82 ms.On("Authenticator").Return(a, nil)
83 ms.On("RunCallbackServer").Return(nil, errors.New("RunCallbackServer error"))
84 tok, err := NewToken(ms)
85 assert.Nil(t, tok)
86 assert.EqualError(t, err, "RunCallbackServer error")
87}
88
89func TestReadToken(t *testing.T) {
90 viper.Set("token.path", "./test-fixtures/test_token.json")

Callers

nothing calls this directly

Calls 2

NewAuthenticatorFunction · 0.85
NewTokenFunction · 0.85

Tested by

no test coverage detected