diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go index ee3ec0fda5..7bdd1701e2 100644 --- a/modules/markup/markdown/markdown_test.go +++ b/modules/markup/markdown/markdown_test.go @@ -21,12 +21,11 @@ import ( ) const ( - AppURL = "http://localhost:3000/" - Repo = "gogits/gogs" - AppSubURL = AppURL + Repo + "/" + AppURL = "http://localhost:3000/" + FullURL = AppURL + "gogits/gogs/" ) -// these values should match the Repo const above +// these values should match the const above var localMetas = map[string]string{ "user": "gogits", "repo": "gogs", @@ -48,13 +47,12 @@ func TestMain(m *testing.M) { func TestRender_StandardLinks(t *testing.T) { setting.AppURL = AppURL - setting.AppSubURL = AppSubURL test := func(input, expected, expectedWiki string) { buffer, err := RenderString(&markup.RenderContext{ Ctx: git.DefaultContext, Links: markup.Links{ - Base: setting.AppSubURL, + Base: FullURL, }, }, input) assert.NoError(t, err) @@ -63,7 +61,7 @@ func TestRender_StandardLinks(t *testing.T) { buffer, err = RenderString(&markup.RenderContext{ Ctx: git.DefaultContext, Links: markup.Links{ - Base: setting.AppSubURL, + Base: FullURL, }, IsWiki: true, }, input) @@ -74,8 +72,8 @@ func TestRender_StandardLinks(t *testing.T) { googleRendered := `
` test("Guardfile-DSL / Configuring-Guard
+ `Guardfile-DSL / Configuring-Guard
`, // special syntax `[[Name|Link]]`, // rendered - ` + ` `, } @@ -323,7 +319,7 @@ func TestTotal_RenderWiki(t *testing.T) { line, err := RenderString(&markup.RenderContext{ Ctx: git.DefaultContext, Links: markup.Links{ - Base: setting.AppSubURL, + Base: FullURL, }, IsWiki: true, }, testCases[i]) @@ -334,15 +330,14 @@ func TestTotal_RenderWiki(t *testing.T) { func TestTotal_RenderString(t *testing.T) { setting.AppURL = AppURL - setting.AppSubURL = AppSubURL - answers := testAnswers(util.URLJoin(AppSubURL, "src", "master"), util.URLJoin(AppSubURL, "media", "master")) + answers := testAnswers(util.URLJoin(FullURL, "src", "master"), util.URLJoin(FullURL, "media", "master")) for i := 0; i < len(sameCases); i++ { line, err := RenderString(&markup.RenderContext{ Ctx: git.DefaultContext, Links: markup.Links{ - Base: AppSubURL, + Base: FullURL, BranchPath: "master", }, Metas: localMetas, @@ -357,7 +352,7 @@ func TestTotal_RenderString(t *testing.T) { line, err := RenderString(&markup.RenderContext{ Ctx: git.DefaultContext, Links: markup.Links{ - Base: AppSubURL, + Base: FullURL, }, }, testCases[i]) assert.NoError(t, err) diff --git a/routers/api/v1/misc/markup_test.go b/routers/api/v1/misc/markup_test.go index ec8f8f47b7..7c7e7ca339 100644 --- a/routers/api/v1/misc/markup_test.go +++ b/routers/api/v1/misc/markup_test.go @@ -20,9 +20,9 @@ import ( ) const ( - AppURL = "http://localhost:3000/" - Repo = "gogits/gogs" - AppSubURL = AppURL + Repo + "/" + AppURL = "http://localhost:3000/" + Repo = "gogits/gogs" + FullURL = AppURL + Repo + "/" ) func testRenderMarkup(t *testing.T, mode, filePath, text, responseBody string, responseCode int) { @@ -74,20 +74,20 @@ func TestAPI_RenderGFM(t *testing.T) { // rendered `Wiki! Enjoy :)
Guardfile-DSL / Configuring-Guard
+ `Guardfile-DSL / Configuring-Guard
`, // special syntax `[[Name|Link]]`, // rendered - ` + ` `, // empty ``, @@ -111,8 +111,8 @@ Here are some links to the most important topics. You can find the full list ofWine Staging on website wine-staging.com.
Here are some links to the most important topics. You can find the full list of pages at the sidebar.
- + `, }