diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2021-08-31 15:35:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-31 14:35:08 +0100 |
commit | 2bb32006fd560af44426a06f63f83e3c70c3f258 (patch) | |
tree | 45bee9d130f770dfca4e76deb897af1315dcfd73 /integrations | |
parent | d21702475ba43100d3a6e9505a1ae259e4842524 (diff) | |
download | gitea-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.go | 20 |
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) { |