清理代码 & 支持 ignore

This commit is contained in:
dragon
2025-05-09 14:50:10 +08:00
parent 9413188aa9
commit ef31433d91
14 changed files with 405 additions and 118 deletions

29
tests/pages_proxy_test.go Normal file
View File

@@ -0,0 +1,29 @@
package tests
import (
"testing"
"github.com/stretchr/testify/assert"
"gopkg.d7z.net/gitea-pages/tests/core"
)
func Test_proxy(t *testing.T) {
server := core.NewDefaultTestServer()
hs := core.NewServer()
defer server.Close()
defer hs.Close()
hs.Add("/test/", "hello proxy")
server.AddFile("org1/repo1/gh-pages/index.html", "hello world")
server.AddFile("org1/repo1/gh-pages/.pages.yaml", `
proxy:
/api: %s/test
`, hs.URL)
data, _, err := server.OpenFile("https://org1.example.com/repo1/")
assert.NoError(t, err)
assert.Equal(t, "hello world", string(data))
data, _, err = server.OpenFile("https://org1.example.com/repo1/api")
assert.NoError(t, err)
assert.Equal(t, "hello proxy", string(data))
}