Check for access in /repositories/:id (#2227)

* Check for access in /repositories/:id

* Integration test
This commit is contained in:
Ethan Koenig authored and Lunny Xiao committed 2017-07-30 09:13:33 +08:00
1 parent a9cc538ab5
commit 49df677c47
2 files changed
+12 -1

No files matched your search

+8
View File
@@ -84,3 +84,11 @@ func TestAPIOrgRepos(t *testing.T) {
assert.False(t, repo.Private)
}
}
func TestAPIGetRepoByIDUnauthorized(t *testing.T) {
prepareTestEnv(t)
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 4}).(*models.User)
sess := loginUser(t, user.Name)
req := NewRequestf(t, "GET", "/api/v1/repositories/2")
sess.MakeRequest(t, req, http.StatusNotFound)
}