summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-04-06 20:42:30 +0200
committerGitHub <noreply@github.com>2020-04-06 19:42:30 +0100
commitad31d6b5e8856b22ddad45477be9d078a869a953 (patch)
tree63a8e832f97b50aee3bef9321fa5f238b0c0e8d4 /integrations
parentef89e75d0eb232e98ca7a7ef278b8681c7f4fe50 (diff)
downloadgitea-ad31d6b5e8856b22ddad45477be9d078a869a953.tar.gz
gitea-ad31d6b5e8856b22ddad45477be9d078a869a953.zip
Fix release counter on API repository info (#10968)
Use the same mechanism as the webpage for calculating the release count Fix #10946
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_repo_test.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/integrations/api_repo_test.go b/integrations/api_repo_test.go
index ff59fac5cb..d57e5daaf3 100644
--- a/integrations/api_repo_test.go
+++ b/integrations/api_repo_test.go
@@ -209,13 +209,31 @@ func getRepo(t *testing.T, repoID int64) *models.Repository {
func TestAPIViewRepo(t *testing.T) {
defer prepareTestEnv(t)()
+ var repo api.Repository
+
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)
+ assert.EqualValues(t, 1, repo.Releases)
+ assert.EqualValues(t, 1, repo.OpenIssues)
+ assert.EqualValues(t, 3, repo.OpenPulls)
+
+ req = NewRequest(t, "GET", "/api/v1/repos/user12/repo10")
+ resp = MakeRequest(t, req, http.StatusOK)
+ DecodeJSON(t, resp, &repo)
+ assert.EqualValues(t, 10, repo.ID)
+ assert.EqualValues(t, "repo10", repo.Name)
+ assert.EqualValues(t, 1, repo.OpenPulls)
+ assert.EqualValues(t, 1, repo.Forks)
+
+ req = NewRequest(t, "GET", "/api/v1/repos/user5/repo4")
+ resp = MakeRequest(t, req, http.StatusOK)
+ DecodeJSON(t, resp, &repo)
+ assert.EqualValues(t, 4, repo.ID)
+ assert.EqualValues(t, "repo4", repo.Name)
+ assert.EqualValues(t, 1, repo.Stars)
}
func TestAPIOrgRepos(t *testing.T) {