Some checks failed
Build and Release / Create Release (push) Successful in 0s
Trigger Vault Plugin Rebuild / Trigger Vault Rebuild (push) Successful in 0s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 2m48s
Build and Release / Lint (push) Failing after 5m2s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, darwin, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (arm64, darwin, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (arm64, linux, linux-latest) (push) Has been skipped
Build and Release / Unit Tests (push) Successful in 5m37s
Go's semantic import versioning requires v2+ modules to include the major version in the module path. This enables using proper version tags (v3.x.x) instead of pseudo-versions. Updated module path: code.gitcaddy.com/server/v3
45 lines
1.6 KiB
Go
45 lines
1.6 KiB
Go
// Copyright 2019 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package integration
|
|
|
|
import (
|
|
"net/http"
|
|
"net/url"
|
|
"strings"
|
|
"testing"
|
|
|
|
"code.gitcaddy.com/server/v3/tests"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func testRepoCommitsSearch(t *testing.T, query, commit string) {
|
|
session := loginUser(t, "user2")
|
|
|
|
// Request repository commits page
|
|
req := NewRequestf(t, "GET", "/user2/commits_search_test/commits/branch/master/search?q=%s", url.QueryEscape(query))
|
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
|
|
|
doc := NewHTMLParser(t, resp.Body)
|
|
sel := doc.doc.Find("#commits-table tbody tr td.sha a")
|
|
assert.Equal(t, commit, strings.TrimSpace(sel.Text()))
|
|
}
|
|
|
|
func TestRepoCommitsSearch(t *testing.T) {
|
|
defer tests.PrepareTestEnv(t)()
|
|
testRepoCommitsSearch(t, "e8eabd", "")
|
|
testRepoCommitsSearch(t, "38a9cb", "")
|
|
testRepoCommitsSearch(t, "6e8e", "6e8eabd9a7")
|
|
testRepoCommitsSearch(t, "58e97", "58e97d1a24")
|
|
testRepoCommitsSearch(t, "[build]", "")
|
|
testRepoCommitsSearch(t, "author:alice", "6e8eabd9a7")
|
|
testRepoCommitsSearch(t, "author:alice 6e8ea", "6e8eabd9a7")
|
|
testRepoCommitsSearch(t, "committer:Tom", "58e97d1a24")
|
|
testRepoCommitsSearch(t, "author:bob commit-4", "58e97d1a24")
|
|
testRepoCommitsSearch(t, "author:bob commit after:2019-03-03", "58e97d1a24")
|
|
testRepoCommitsSearch(t, "committer:alice 6e8e before:2019-03-02", "6e8eabd9a7")
|
|
testRepoCommitsSearch(t, "committer:alice commit before:2019-03-02", "6e8eabd9a7")
|
|
testRepoCommitsSearch(t, "committer:alice author:tom commit before:2019-03-04 after:2019-03-02", "0a8499a22a")
|
|
}
|