mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-25 14:26:58 +00:00
nit
This commit is contained in:
parent
5a5a7274c2
commit
0c622d1eac
2 changed files with 6 additions and 5 deletions
|
@ -16,7 +16,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetRedirect(t *testing.T) {
|
func TestGetRedirect(t *testing.T) {
|
||||||
log.Printf("== TestGetRedirect ==\n")
|
log.Printf("=== TestGetRedirect ===\n")
|
||||||
// test custom domain redirect
|
// test custom domain redirect
|
||||||
resp, err := getTestHTTPSClient().Get("https://calciumdibromid.localhost.mock.directory:4430")
|
resp, err := getTestHTTPSClient().Get("https://calciumdibromid.localhost.mock.directory:4430")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
@ -28,7 +28,7 @@ func TestGetRedirect(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetContent(t *testing.T) {
|
func TestGetContent(t *testing.T) {
|
||||||
log.Printf("== TestGetContent ==\n")
|
log.Printf("=== TestGetContent ===\n")
|
||||||
// test get image
|
// test get image
|
||||||
resp, err := getTestHTTPSClient().Get("https://magiclike.localhost.mock.directory:4430/images/827679288a.jpg")
|
resp, err := getTestHTTPSClient().Get("https://magiclike.localhost.mock.directory:4430/images/827679288a.jpg")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
@ -50,6 +50,7 @@ func TestGetContent(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCustomDomain(t *testing.T) {
|
func TestCustomDomain(t *testing.T) {
|
||||||
|
log.Printf("=== TestCustomDomain ===\n")
|
||||||
resp, err := getTestHTTPSClient().Get("https://mock-pages.codeberg-test.org:4430/README.md")
|
resp, err := getTestHTTPSClient().Get("https://mock-pages.codeberg-test.org:4430/README.md")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
if !assert.EqualValues(t, http.StatusOK, resp.StatusCode) {
|
if !assert.EqualValues(t, http.StatusOK, resp.StatusCode) {
|
||||||
|
@ -60,7 +61,7 @@ func TestCustomDomain(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetNotFound(t *testing.T) {
|
func TestGetNotFound(t *testing.T) {
|
||||||
log.Printf("== TestGetNotFound ==\n")
|
log.Printf("=== TestGetNotFound ===\n")
|
||||||
// test custom not found pages
|
// test custom not found pages
|
||||||
resp, err := getTestHTTPSClient().Get("https://crystal.localhost.mock.directory:4430/pages-404-demo/blah")
|
resp, err := getTestHTTPSClient().Get("https://crystal.localhost.mock.directory:4430/pages-404-demo/blah")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
|
@ -16,14 +16,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
log.Printf("=== TestMain: START Server ==\n")
|
log.Printf("=== TestMain: START Server ===\n")
|
||||||
serverCtx, serverCancel := context.WithCancel(context.Background())
|
serverCtx, serverCancel := context.WithCancel(context.Background())
|
||||||
if err := startServer(serverCtx); err != nil {
|
if err := startServer(serverCtx); err != nil {
|
||||||
log.Fatal().Msgf("could not start server: %v", err)
|
log.Fatal().Msgf("could not start server: %v", err)
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
serverCancel()
|
serverCancel()
|
||||||
log.Printf("=== TestMain: Server STOPED ==\n")
|
log.Printf("=== TestMain: Server STOPED ===\n")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
time.Sleep(20 * time.Second)
|
time.Sleep(20 * time.Second)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue