Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test img links in markdown #23246

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion models/fixtures/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
fork_id: 0
is_template: false
template_id: 0
size: 6708
size: 7028
is_fsck_enabled: true
close_issues_via_commit_in_any_branch: false

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
78fb907e3a3309eae4fe8fef030874cebbf1cd5e
20 changes: 20 additions & 0 deletions tests/integration/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,23 @@ func TestViewRepoDirectory(t *testing.T) {
assert.Zero(t, repoTopics.Length())
assert.Zero(t, repoSummary.Length())
}

func TestMarkDownImage(t *testing.T) {
defer tests.PrepareTestEnv(t)()

session := loginUser(t, "user2")

req := NewRequest(t, "GET", "/user2/repo1/src/branch/home-md-img-check")
resp := session.MakeRequest(t, req, http.StatusOK)

htmlDoc := NewHTMLParser(t, resp.Body)
_, exists := htmlDoc.doc.Find("img[src=\"/user2/repo1/media/branch/home-md-img-check/test-fake-img.jpg\"]").Attr("src")
assert.True(t, exists, "Repo home page markdown image link check failed")

req = NewRequest(t, "GET", "/user2/repo1/src/branch/home-md-img-check/README.md")
resp = session.MakeRequest(t, req, http.StatusOK)

htmlDoc = NewHTMLParser(t, resp.Body)
_, exists = htmlDoc.doc.Find("img[src=\"/user2/repo1/media/branch/home-md-img-check/test-fake-img.jpg\"]").Attr("src")
assert.True(t, exists, "Repo src page markdown image link check failed")
}