diff options
author | 6543 <6543@obermui.de> | 2021-08-31 17:58:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-31 17:58:39 +0200 |
commit | cbe3ca5d0b74556679884e2f694944895ed1d8a9 (patch) | |
tree | 937aba470fcb8cb31a44d98acd3a654c1a2fbbb2 /integrations | |
parent | 3ac1f35349ec7d4d76fdf13ade34307138e5a2a4 (diff) | |
download | gitea-cbe3ca5d0b74556679884e2f694944895ed1d8a9.tar.gz gitea-cbe3ca5d0b74556679884e2f694944895ed1d8a9.zip |
Test if LFS object is accessible (#16865) (#16904)
* Test if object is accessible.
* Added more logging.
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
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 9e1e2b0418..49350c428a 100644 --- a/integrations/api_repo_lfs_test.go +++ b/integrations/api_repo_lfs_test.go @@ -254,6 +254,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) @@ -359,13 +363,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) { |