Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuomo Ala-Vannesluoma <tuomoav@gmail.com>2018-07-09 21:49:40 +0300
committerTuomo Ala-Vannesluoma <tuomoav@gmail.com>2018-07-19 19:09:52 +0300
commit2666c24dacb27efd22ad78044d4f321beed63772 (patch)
tree767dd559c5ff2400a40e6a7d9d6c4934cfd3e0af /internal/auth/auth_test.go
parentbcadf897da62964c8448add086bc03d6352109f8 (diff)
Update to new endpoint and switch to better (user) endpoint when checking for token validity
Diffstat (limited to 'internal/auth/auth_test.go')
-rw-r--r--internal/auth/auth_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go
index 69f1d731..f95583b3 100644
--- a/internal/auth/auth_test.go
+++ b/internal/auth/auth_test.go
@@ -69,7 +69,7 @@ func TestTryAuthenticateWithCodeAndState(t *testing.T) {
assert.Equal(t, "POST", r.Method)
w.WriteHeader(http.StatusOK)
fmt.Fprint(w, "{\"access_token\":\"abc\"}")
- case "/api/v4/projects/1000":
+ case "/api/v4/projects/1000/pages_access":
assert.Equal(t, "Bearer abc", r.Header.Get("Authorization"))
w.WriteHeader(http.StatusOK)
default:
@@ -108,7 +108,7 @@ func TestTryAuthenticateWithCodeAndState(t *testing.T) {
func TestCheckAuthenticationWhenAccess(t *testing.T) {
apiServer := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
- case "/api/v4/projects/1000":
+ case "/api/v4/projects/1000/pages_access":
assert.Equal(t, "Bearer abc", r.Header.Get("Authorization"))
w.WriteHeader(http.StatusOK)
default:
@@ -145,7 +145,7 @@ func TestCheckAuthenticationWhenAccess(t *testing.T) {
func TestCheckAuthenticationWhenNoAccess(t *testing.T) {
apiServer := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
- case "/api/v4/projects/1000":
+ case "/api/v4/projects/1000/pages_access":
assert.Equal(t, "Bearer abc", r.Header.Get("Authorization"))
w.WriteHeader(http.StatusUnauthorized)
default:
@@ -182,7 +182,7 @@ func TestCheckAuthenticationWhenNoAccess(t *testing.T) {
func TestCheckAuthenticationWhenInvalidToken(t *testing.T) {
apiServer := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
- case "/api/v4/projects/1000":
+ case "/api/v4/projects/1000/pages_access":
assert.Equal(t, "Bearer abc", r.Header.Get("Authorization"))
w.WriteHeader(http.StatusUnauthorized)
fmt.Fprint(w, "{\"error\":\"invalid_token\"}")
@@ -220,7 +220,7 @@ func TestCheckAuthenticationWhenInvalidToken(t *testing.T) {
func TestCheckAuthenticationWithoutProject(t *testing.T) {
apiServer := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
- case "/api/v4/projects":
+ case "/api/v4/user":
assert.Equal(t, "Bearer abc", r.Header.Get("Authorization"))
w.WriteHeader(http.StatusOK)
default:
@@ -257,7 +257,7 @@ func TestCheckAuthenticationWithoutProject(t *testing.T) {
func TestCheckAuthenticationWithoutProjectWhenInvalidToken(t *testing.T) {
apiServer := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
- case "/api/v4/projects":
+ case "/api/v4/user":
assert.Equal(t, "Bearer abc", r.Header.Get("Authorization"))
w.WriteHeader(http.StatusUnauthorized)
fmt.Fprint(w, "{\"error\":\"invalid_token\"}")