func Test_CallbackUrlIsNotSet(t *testing.T) { auth := oauth.OAuthAuthenticator{} _, err := auth.CallbackPath() if err == nil { t.Error("should return error since callback url is not set") } }
func Test_ValidCallbackUrl_WaitExtractPath(t *testing.T) { auth := oauth.OAuthAuthenticator{ CallbackURL: "http://abc.com/something/oauth", } s, _ := auth.CallbackPath() if s != "/something/oauth" { t.Error("incorrect path") } }
func Test_InvalidCallbackUrl(t *testing.T) { auth := oauth.OAuthAuthenticator{ CallbackURL: "http://www.example.c%om/", } _, err := auth.CallbackPath() if err == nil { t.Error("should return error since not a callback url") } }