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 37 38 39 40 41 42 43 44 45 46 47
|
package cloudfoundry_test
import (
"github.com/markbates/goth"
"github.com/markbates/goth/providers/cloudfoundry"
"github.com/stretchr/testify/assert"
"testing"
)
func Test_Implements_Session(t *testing.T) {
t.Parallel()
a := assert.New(t)
s := &cloudfoundry.Session{}
a.Implements((*goth.Session)(nil), s)
}
func Test_GetAuthURL(t *testing.T) {
t.Parallel()
a := assert.New(t)
s := &cloudfoundry.Session{}
_, err := s.GetAuthURL()
a.Error(err)
s.AuthURL = "/foo"
url, _ := s.GetAuthURL()
a.Equal(url, "/foo")
}
func Test_ToJSON(t *testing.T) {
t.Parallel()
a := assert.New(t)
s := &cloudfoundry.Session{}
data := s.Marshal()
a.Equal(data, `{"AuthURL":"","AccessToken":"","RefreshToken":"","ExpiresAt":"0001-01-01T00:00:00Z"}`)
}
func Test_String(t *testing.T) {
t.Parallel()
a := assert.New(t)
s := &cloudfoundry.Session{}
a.Equal(s.String(), s.Marshal())
}
|