1
0
Fork 0
forked from forgejo/forgejo

Fix repo API bug (#2133)

Don't require token when not necessary
This commit is contained in:
Ethan Koenig 2017-07-11 21:23:41 -04:00 committed by Kim "BKC" Carlbäcker
parent da89afda58
commit 93a1de4842
9 changed files with 132 additions and 54 deletions

View file

@ -51,3 +51,15 @@ func TestAPISearchRepoNotLogin(t *testing.T) {
assert.True(t, strings.Contains(repo.Name, keyword))
}
}
func TestAPIViewRepo(t *testing.T) {
prepareTestEnv(t)
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo1")
resp := MakeRequest(t, req, http.StatusOK)
var repo api.Repository
DecodeJSON(t, resp, &repo)
assert.EqualValues(t, 1, repo.ID)
assert.EqualValues(t, "repo1", repo.Name)
}