forked from gilcrest/diygoapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth_test.go
36 lines (32 loc) · 848 Bytes
/
auth_test.go
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
36
package diygoapi_test
import (
"github.com/gilcrest/diygoapi"
"testing"
qt "github.com/frankban/quicktest"
)
func TestNewProvider(t *testing.T) {
t.Run("google", func(t *testing.T) {
c := qt.New(t)
p := diygoapi.ParseProvider("GoOgLe")
c.Assert(p, qt.Equals, diygoapi.Google)
})
t.Run("unknown", func(t *testing.T) {
c := qt.New(t)
p := diygoapi.ParseProvider("anything else!")
c.Assert(p, qt.Equals, diygoapi.UnknownProvider)
})
}
func TestProvider_String(t *testing.T) {
t.Run("google", func(t *testing.T) {
c := qt.New(t)
p := diygoapi.ParseProvider("GoOgLe")
provider := p.String()
c.Assert(provider, qt.Equals, "google")
})
t.Run("unknown", func(t *testing.T) {
c := qt.New(t)
p := diygoapi.ParseProvider("anything else")
provider := p.String()
c.Assert(provider, qt.Equals, "unknown_provider")
})
}