コード例 #1
0
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")
	}
}
コード例 #2
0
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")
	}
}
コード例 #3
0
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")
	}
}