]> source.dussan.org Git - gitea.git/commitdiff
Fix test fixtures for user2/lfs.git (#32477)
authorwxiaoguang <wxiaoguang@gmail.com>
Tue, 12 Nov 2024 05:41:22 +0000 (13:41 +0800)
committerGitHub <noreply@github.com>
Tue, 12 Nov 2024 05:41:22 +0000 (05:41 +0000)
models/fixtures/lfs_meta_object.yml
tests/gitea-repositories-meta/user2/lfs.git/objects/30/77e1c4c8964613df72c37d14275c1eda5228a9 [deleted file]
tests/gitea-repositories-meta/user2/lfs.git/objects/6b/bc79965141058b0026f2064dfb6d2eae3c4540 [deleted file]
tests/gitea-repositories-meta/user2/lfs.git/objects/b0/89e97ee59224e8c5676673c096ee4b6a8b9342 [deleted file]
tests/gitea-repositories-meta/user2/lfs.git/objects/e9/c32647bab825977942598c0efa415de300304b [deleted file]
tests/gitea-repositories-meta/user2/lfs.git/refs/heads/master
tests/integration/lfs_view_test.go

index 5430506d70a623834f0c64ade38dd1d04785258f..ae5ae565425fc8848aaf137dc0318f4b9282ec93 100644 (file)
@@ -1,11 +1,4 @@
 # 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
@@ -18,7 +11,7 @@
 
   id: 2
   oid: 2eccdb43825d2a49d99d542daa20075cff1d97d9d2349a8977efe9c03661737c
-  size: 107 # real size is 2048
+  size: 2048
   repository_id: 54
   created_unix: 1671607299
 
   size: 25
   repository_id: 54
   created_unix: 1671607299
-
-# this file is missing
-# -
-#
-#   id: 5
-#   oid: 9d178b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351
-#   size: 25
-#   repository_id: 54
-#   created_unix: 1671607299
diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/30/77e1c4c8964613df72c37d14275c1eda5228a9 b/tests/gitea-repositories-meta/user2/lfs.git/objects/30/77e1c4c8964613df72c37d14275c1eda5228a9
deleted file mode 100644 (file)
index c2dc6e5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-x\ 1KÊÉOR0´0`pö÷\v        òt
-\rñôs×ËMQHËÌ)I-²ÍI+VHÉLK\ 33rS\8bÒSÁ,Ý\92Ô\8a\12.-½¬\82t"U&eæ\11¥23¯,1'\93\ 1ØæAÅ
\ No newline at end of file
diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/6b/bc79965141058b0026f2064dfb6d2eae3c4540 b/tests/gitea-repositories-meta/user2/lfs.git/objects/6b/bc79965141058b0026f2064dfb6d2eae3c4540
deleted file mode 100644 (file)
index 97455cb..0000000
Binary files a/tests/gitea-repositories-meta/user2/lfs.git/objects/6b/bc79965141058b0026f2064dfb6d2eae3c4540 and /dev/null differ
diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/b0/89e97ee59224e8c5676673c096ee4b6a8b9342 b/tests/gitea-repositories-meta/user2/lfs.git/objects/b0/89e97ee59224e8c5676673c096ee4b6a8b9342
deleted file mode 100644 (file)
index 33ab64e..0000000
Binary files a/tests/gitea-repositories-meta/user2/lfs.git/objects/b0/89e97ee59224e8c5676673c096ee4b6a8b9342 and /dev/null differ
diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/e9/c32647bab825977942598c0efa415de300304b b/tests/gitea-repositories-meta/user2/lfs.git/objects/e9/c32647bab825977942598c0efa415de300304b
deleted file mode 100644 (file)
index f513e2a..0000000
Binary files a/tests/gitea-repositories-meta/user2/lfs.git/objects/e9/c32647bab825977942598c0efa415de300304b and /dev/null differ
index 487a433af2d430972d619069a73b4913b9011db7..8832a3e8571951f02c88fc82008e62182b172f7e 100644 (file)
@@ -1 +1 @@
-e9c32647bab825977942598c0efa415de300304b
+73cf03db6ece34e12bf91e8853dc58f678f2f82d
index 05770e5e0a3bd58db6642350d3c9307b56e117f3..a0e004ed58e59a25caeb742be42fe4079ad9e5b0 100644 (file)
@@ -10,6 +10,8 @@ import (
        "strings"
        "testing"
 
+       "code.gitea.io/gitea/models/db"
+       "code.gitea.io/gitea/models/git"
        repo_model "code.gitea.io/gitea/models/repo"
        "code.gitea.io/gitea/models/unittest"
        user_model "code.gitea.io/gitea/models/user"
@@ -94,13 +96,18 @@ func TestLFSRender(t *testing.T) {
        t.Run("Invalid", func(t *testing.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)
+               content := NewHTMLParser(t, resp.Body).Find("div.file-view").Text()
+               assert.Contains(t, content, "Testing documents in LFS")
 
-               doc := NewHTMLParser(t, resp.Body).doc
-
-               content := doc.Find("div.file-view").Text()
-               assert.Contains(t, content, "oid sha256:9d178b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351")
+               // then make it disappear
+               assert.NoError(t, db.TruncateBeans(db.DefaultContext, &git.LFSMetaObject{}))
+               req = NewRequest(t, "GET", "/user2/lfs/src/branch/master/CONTRIBUTING.md")
+               resp = session.MakeRequest(t, req, http.StatusOK)
+               content = NewHTMLParser(t, resp.Body).Find("div.file-view").Text()
+               assert.Contains(t, content, "oid sha256:7b6b2c88dba9f760a1a58469b67fee2b698ef7e9399c4ca4f34a14ccbe39f623")
        })
 }