🎨 Used special domains in test objects
/ docker (push) Successful in 1m53s Details

See https://datatracker.ietf.org/doc/html/rfc6761#section-6.2
This commit is contained in:
Maxim Lebedev 2024-02-17 00:30:24 +06:00
parent 326b7a478a
commit 4730b7074f
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
3 changed files with 12 additions and 10 deletions

View File

@ -43,7 +43,7 @@ func TestSite(tb testing.TB) *Site {
DefaultLanguage: en,
Language: ru,
Languages: []Language{en, ru},
BaseURL: &url.URL{Scheme: "https", Host: "example.com", Path: "/"},
BaseURL: &url.URL{Scheme: "https", Host: "test.web.site", Path: "/"},
TimeZone: time.UTC,
File: NewPath(filepath.Join("content", "index.en.md")),
Title: "Testing",
@ -76,8 +76,8 @@ func TestSite(tb testing.TB) *Site {
"headers": []any{map[string]any{
"path": "/**",
"values": map[string]any{
"Link": `<https://auth.example.com/>; rel="indieauth-metadata", ` +
`<https://pub.example.com/>; rel="micropub"`,
"Link": `<https://test.auth.app/>; rel="indieauth-metadata", ` +
`<https://test.pub.app/>; rel="micropub"`,
"X-Koroko": "Ya-ha-ha!",
},
}, map[string]any{
@ -92,7 +92,7 @@ func TestSite(tb testing.TB) *Site {
"status": 302,
}, map[string]any{
"from": "/foo",
"to": "https://example.com/",
"to": "https://test.redirect.site/",
"status": 301,
"force": true,
}},

View File

@ -8,14 +8,16 @@ import (
"source.toby3d.me/toby3d/home/internal/domain"
"source.toby3d.me/toby3d/home/internal/server/usecase"
"source.toby3d.me/toby3d/home/internal/site/repository/stub"
)
func TestDo(t *testing.T) {
t.Parallel()
site := domain.TestSite(t)
testSite := domain.TestSite(t)
actual, err := usecase.NewServerUseCase().Do(context.Background(), site)
actual, err := usecase.NewServerUseCase(stub.NewStubSiteRepository(testSite, nil)).
Do(context.Background(), testSite.Language)
if err != nil {
t.Fatal(err)
}
@ -24,8 +26,8 @@ func TestDo(t *testing.T) {
Headers: []domain.Header{{
Path: "/**",
Values: map[string]string{
"Link": `<https://auth.example.com/>; rel="indieauth-metadata", ` +
`<https://pub.example.com/>; rel="micropub"`,
"Link": `<https://test.auth.app/>; rel="indieauth-metadata", ` +
`<https://test.pub.app/>; rel="micropub"`,
"X-Koroko": "Ya-ha-ha!",
},
}, {
@ -41,7 +43,7 @@ func TestDo(t *testing.T) {
Force: false,
}, {
From: "/foo",
To: "https://example.com/",
To: "https://test.redirect.site/",
Status: 301,
Force: true,
}},

View File

@ -1 +1 @@
{"subject":"acct:user@example.com","links":[{"rel":"self","type":"application/activity+json","href":"https://example.com/"},{"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://example.com/"},{"rel":"http://webfinger.net/rel/avatar","type":"image/jpeg","href":"https://example.com/logo.jpg"}]}
{"subject":"acct:user@test.web.site","links":[{"rel":"self","type":"application/activity+json","href":"https://test.web.site/"},{"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://test.web.site/"},{"rel":"http://webfinger.net/rel/avatar","type":"image/jpeg","href":"https://test.web.site/"}]}