forked from markbates/goth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprovider_test.go
More file actions
35 lines (27 loc) · 730 Bytes
/
provider_test.go
File metadata and controls
35 lines (27 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package goth_test
import (
"testing"
"github.com/markbates/goth"
"github.com/markbates/goth/providers/faux"
"github.com/stretchr/testify/assert"
)
func Test_UseProviders(t *testing.T) {
a := assert.New(t)
provider := &faux.Provider{}
goth.UseProviders(provider)
a.Equal(len(goth.GetProviders()), 1)
a.Equal(goth.GetProviders()[provider.Name()], provider)
goth.ClearProviders()
}
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)
_, err = goth.GetProvider("unknown")
a.Error(err)
a.Equal(err.Error(), "no provider for unknown exists")
goth.ClearProviders()
}