summaryrefslogtreecommitdiffstats
path: root/modules/markup/html_test.go
diff options
context:
space:
mode:
authormrsdizzie <info@mrsdizzie.com>2019-04-16 03:53:57 -0400
committerzeripath <art27@cantab.net>2019-04-16 08:53:57 +0100
commit1bce1894f5ceefff2af0ebb95d060cec6f9c21b2 (patch)
tree280e3b2cb5e7e4306e983d030a7d0018292414e0 /modules/markup/html_test.go
parente98565ddc71013bc4bc5537f15f545cf909fac3a (diff)
downloadgitea-1bce1894f5ceefff2af0ebb95d060cec6f9c21b2.tar.gz
gitea-1bce1894f5ceefff2af0ebb95d060cec6f9c21b2.zip
Use ctx.metas for SHA hash links (#6645)
Since #6273 was merged, we now have access to proper context metas always. Update SHA generated links to use these instead of urlPrefix. Update tests as well. Fixes #4536.
Diffstat (limited to 'modules/markup/html_test.go')
-rw-r--r--modules/markup/html_test.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go
index 6d3da31934..543db1d462 100644
--- a/modules/markup/html_test.go
+++ b/modules/markup/html_test.go
@@ -16,12 +16,17 @@ import (
"github.com/stretchr/testify/assert"
)
+var localMetas = map[string]string{
+ "user": "gogits",
+ "repo": "gogs",
+}
+
func TestRender_Commits(t *testing.T) {
setting.AppURL = AppURL
setting.AppSubURL = AppSubURL
test := func(input, expected string) {
- buffer := RenderString(".md", input, setting.AppSubURL, nil)
+ buffer := RenderString(".md", input, setting.AppSubURL, localMetas)
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
}
@@ -45,7 +50,7 @@ func TestRender_CrossReferences(t *testing.T) {
setting.AppSubURL = AppSubURL
test := func(input, expected string) {
- buffer := RenderString("a.md", input, setting.AppSubURL, nil)
+ buffer := RenderString("a.md", input, setting.AppSubURL, localMetas)
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
}
@@ -195,7 +200,7 @@ func TestRender_ShortLinks(t *testing.T) {
test := func(input, expected, expectedWiki string) {
buffer := markdown.RenderString(input, tree, nil)
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(string(buffer)))
- buffer = markdown.RenderWiki([]byte(input), setting.AppSubURL, nil)
+ buffer = markdown.RenderWiki([]byte(input), setting.AppSubURL, localMetas)
assert.Equal(t, strings.TrimSpace(expectedWiki), strings.TrimSpace(string(buffer)))
}