2017-08-17 17:50:21 +05:30
|
|
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
2022-11-27 23:50:29 +05:30
|
|
|
// SPDX-License-Identifier: MIT
|
2017-08-17 17:50:21 +05:30
|
|
|
|
2022-09-03 00:48:23 +05:30
|
|
|
package integration
|
2017-08-17 17:50:21 +05:30
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
2022-09-03 00:48:23 +05:30
|
|
|
|
|
|
|
"code.gitea.io/gitea/tests"
|
2024-02-26 20:47:11 +05:30
|
|
|
"github.com/stretchr/testify/assert"
|
2017-08-17 17:50:21 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
func TestExploreRepos(t *testing.T) {
|
2022-09-03 00:48:23 +05:30
|
|
|
defer tests.PrepareTestEnv(t)()
|
2017-08-17 17:50:21 +05:30
|
|
|
|
|
|
|
req := NewRequest(t, "GET", "/explore/repos")
|
|
|
|
MakeRequest(t, req, http.StatusOK)
|
2024-02-26 20:47:11 +05:30
|
|
|
|
|
|
|
t.Run("Persistent parameters", func(t *testing.T) {
|
|
|
|
defer tests.PrintCurrentTest(t)()
|
|
|
|
|
|
|
|
req := NewRequest(t, "GET", "/explore/repos?topic=1&language=Go&sort=moststars")
|
|
|
|
resp := MakeRequest(t, req, http.StatusOK)
|
|
|
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
|
|
|
|
|
|
|
assert.EqualValues(t, "moststars", htmlDoc.Find("input[type='hidden'][name='sort']").AttrOr("value", "not found"))
|
|
|
|
assert.EqualValues(t, "Go", htmlDoc.Find("input[type='hidden'][name='language']").AttrOr("value", "not found"))
|
|
|
|
assert.EqualValues(t, "true", htmlDoc.Find("input[type='hidden'][name='topic']").AttrOr("value", "not found"))
|
|
|
|
})
|
2017-08-17 17:50:21 +05:30
|
|
|
}
|