|
|
@ -10,6 +10,8 @@ import ( |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"testing" |
|
|
|
"testing" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models/db" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/models/git" |
|
|
|
repo_model "code.gitea.io/gitea/models/repo" |
|
|
|
repo_model "code.gitea.io/gitea/models/repo" |
|
|
|
"code.gitea.io/gitea/models/unittest" |
|
|
|
"code.gitea.io/gitea/models/unittest" |
|
|
|
user_model "code.gitea.io/gitea/models/user" |
|
|
|
user_model "code.gitea.io/gitea/models/user" |
|
|
@ -94,13 +96,18 @@ func TestLFSRender(t *testing.T) { |
|
|
|
t.Run("Invalid", func(t *testing.T) { |
|
|
|
t.Run("Invalid", func(t *testing.T) { |
|
|
|
defer tests.PrintCurrentTest(t)() |
|
|
|
defer tests.PrintCurrentTest(t)() |
|
|
|
|
|
|
|
|
|
|
|
req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/invalid") |
|
|
|
// the LFS exists
|
|
|
|
|
|
|
|
req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/CONTRIBUTING.md") |
|
|
|
resp := session.MakeRequest(t, req, http.StatusOK) |
|
|
|
resp := session.MakeRequest(t, req, http.StatusOK) |
|
|
|
|
|
|
|
content := NewHTMLParser(t, resp.Body).Find("div.file-view").Text() |
|
|
|
|
|
|
|
assert.Contains(t, content, "Testing documents in LFS") |
|
|
|
|
|
|
|
|
|
|
|
doc := NewHTMLParser(t, resp.Body).doc |
|
|
|
// then make it disappear
|
|
|
|
|
|
|
|
assert.NoError(t, db.TruncateBeans(db.DefaultContext, &git.LFSMetaObject{})) |
|
|
|
content := doc.Find("div.file-view").Text() |
|
|
|
req = NewRequest(t, "GET", "/user2/lfs/src/branch/master/CONTRIBUTING.md") |
|
|
|
assert.Contains(t, content, "oid sha256:9d178b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351") |
|
|
|
resp = session.MakeRequest(t, req, http.StatusOK) |
|
|
|
|
|
|
|
content = NewHTMLParser(t, resp.Body).Find("div.file-view").Text() |
|
|
|
|
|
|
|
assert.Contains(t, content, "oid sha256:7b6b2c88dba9f760a1a58469b67fee2b698ef7e9399c4ca4f34a14ccbe39f623") |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|