Fix test fixtures for user2/lfs.git (#32477)

This commit is contained in:
wxiaoguang 2024-11-12 13:41:22 +08:00 committed by GitHub
parent 4c924bf43c
commit 160ccb5ee2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 14 additions and 25 deletions

View File

@ -1,11 +1,4 @@
# These are the LFS objects in user2/lfs.git # These are the LFS objects in user2/lfs.git
# user2/lfs is an INVALID repository
#
# commit e9c32647bab825977942598c0efa415de300304b (HEAD -> master)
# Author: Rowan Bohde <rowan.bohde@gmail.com>
# Date: Thu Aug 1 14:38:23 2024 -0500
#
# add invalid lfs file
- -
id: 1 id: 1
@ -18,7 +11,7 @@
id: 2 id: 2
oid: 2eccdb43825d2a49d99d542daa20075cff1d97d9d2349a8977efe9c03661737c oid: 2eccdb43825d2a49d99d542daa20075cff1d97d9d2349a8977efe9c03661737c
size: 107 # real size is 2048 size: 2048
repository_id: 54 repository_id: 54
created_unix: 1671607299 created_unix: 1671607299
@ -37,12 +30,3 @@
size: 25 size: 25
repository_id: 54 repository_id: 54
created_unix: 1671607299 created_unix: 1671607299
# this file is missing
# -
#
# id: 5
# oid: 9d178b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351
# size: 25
# repository_id: 54
# created_unix: 1671607299

View File

@ -1,2 +0,0 @@
xKÊÉOR0´0`pö÷ òt
ñôs×ËMQHËÌ)I-²ÍI+VHÉLK3rSÒSÁ,Ý’ÔŠ.-½¬t"U&eæ¥23¯,1'“8ûØæAÅ

View File

@ -1 +1 @@
e9c32647bab825977942598c0efa415de300304b 73cf03db6ece34e12bf91e8853dc58f678f2f82d

View File

@ -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")
}) })
} }