func Test_GetProvider(t *testing.T) { a := assert.New(t) provider := &faux.Provider{} goth.UseProviders(provider) p, err := goth.GetProvider(provider.Name()) a.NoError(err) a.Equal(p, provider) p, err = goth.GetProvider("unknown") a.Error(err) a.Equal(err.Error(), "no provider for unknown exists") goth.ClearProviders() }
func getPlatform(c *echo.Context) (goth.Provider, error) { platformName, err := getPlatformName(c) if err != nil { return nil, err } platform, err := goth.GetProvider(platformName) if err != nil { return nil, echo.NewHTTPError(http.StatusNotImplemented, "Platform unavailable.") } return platform, nil }