Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: appleboy <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Apr 13, 2024
1 parent c2c3e59 commit a21234b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/integration/api_repo_compare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package integration

import (
"log"
"net/http"
"testing"

Expand All @@ -17,24 +16,23 @@ import (
"github.com/stretchr/testify/assert"
)

func TestAPICompareTag(t *testing.T) {
func TestAPICompareBranches(t *testing.T) {
defer tests.PrepareTestEnv(t)()

user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
// Login as User2.
session := loginUser(t, user.Name)
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)

repoName := "repo1"
repoName := "repo20"

req := NewRequestf(t, "GET", "/api/v1/repos/user2/%s/compare/v1.1...master", repoName).
req := NewRequestf(t, "GET", "/api/v1/repos/user2/%s/compare/add-csv...remove-files-b", repoName).
AddTokenAuth(token)
resp := MakeRequest(t, req, http.StatusOK)

var apiResp *api.Compare
DecodeJSON(t, resp, &apiResp)

log.Printf("Total commits: %v", apiResp.TotalCommits)
log.Printf("Commits: %v", apiResp.Commits)
assert.Len(t, apiResp.TotalCommits, 1)
assert.Equal(t, 2, apiResp.TotalCommits)
assert.Len(t, apiResp.Commits, 2)
}

0 comments on commit a21234b

Please sign in to comment.