summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-08-31 15:35:08 +0200
committerGitHub <noreply@github.com>2021-08-31 14:35:08 +0100
commit2bb32006fd560af44426a06f63f83e3c70c3f258 (patch)
tree45bee9d130f770dfca4e76deb897af1315dcfd73 /integrations
parentd21702475ba43100d3a6e9505a1ae259e4842524 (diff)
downloadgitea-2bb32006fd560af44426a06f63f83e3c70c3f258.tar.gz
gitea-2bb32006fd560af44426a06f63f83e3c70c3f258.zip
Test if LFS object is accessible (#16865)
* Test if object is accessible. * Added more logging.
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_repo_lfs_test.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/integrations/api_repo_lfs_test.go b/integrations/api_repo_lfs_test.go
index 7aa172064e..56a6fa81fd 100644
--- a/integrations/api_repo_lfs_test.go
+++ b/integrations/api_repo_lfs_test.go
@@ -253,6 +253,10 @@ func TestAPILFSBatch(t *testing.T) {
assert.NoError(t, err)
assert.True(t, exist)
+ repo2 := createLFSTestRepository(t, "batch2")
+ content := []byte("dummy0")
+ storeObjectInRepo(t, repo2.ID, &content)
+
meta, err := repo.GetLFSMetaObjectByOid(p.Oid)
assert.Nil(t, meta)
assert.Equal(t, models.ErrLFSObjectNotExist, err)
@@ -358,13 +362,19 @@ func TestAPILFSUpload(t *testing.T) {
assert.Nil(t, meta)
assert.Equal(t, models.ErrLFSObjectNotExist, err)
- req := newRequest(t, p, "")
+ t.Run("InvalidAccess", func(t *testing.T) {
+ req := newRequest(t, p, "invalid")
+ session.MakeRequest(t, req, http.StatusUnprocessableEntity)
+ })
- session.MakeRequest(t, req, http.StatusOK)
+ t.Run("ValidAccess", func(t *testing.T) {
+ req := newRequest(t, p, "dummy5")
- meta, err = repo.GetLFSMetaObjectByOid(p.Oid)
- assert.NoError(t, err)
- assert.NotNil(t, meta)
+ session.MakeRequest(t, req, http.StatusOK)
+ meta, err = repo.GetLFSMetaObjectByOid(p.Oid)
+ assert.NoError(t, err)
+ assert.NotNil(t, meta)
+ })
})
t.Run("MetaAlreadyExists", func(t *testing.T) {