Task Attachments #104

Merged
konrad merged 63 commits from feature/attachments into master 2019-10-16 20:52:31 +00:00
1 changed files with 61 additions and 0 deletions
Showing only changes of commit 74a17bfe92 - Show all commits

61
pkg/files/files_test.go Normal file
View File

@ -0,0 +1,61 @@
// Copyright 2019 Vikunja and contriubtors. All rights reserved.
//
// This file is part of Vikunja.
//
// Vikunja is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vikunja is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vikunja. If not, see <https://www.gnu.org/licenses/>.
package files
import (
"github.com/stretchr/testify/assert"
"os"
"testing"
)
func TestCreate(t *testing.T) {
}
func TestFile_Delete(t *testing.T) {
}
func TestFile_LoadFileByID(t *testing.T) {
t.Run("Normal", func(t *testing.T) {
f := &File{ID: 1}
err := f.LoadFileByID()
assert.NoError(t, err)
})
t.Run("Nonexisting", func(t *testing.T) {
f := &File{ID: 9999}
err := f.LoadFileByID()
assert.Error(t, err)
assert.True(t, os.IsNotExist(err))
})
}
func TestFile_LoadFileMetaByID(t *testing.T) {
t.Run("Normal", func(t *testing.T) {
f := &File{ID: 1}
err := f.LoadFileMetaByID()
assert.NoError(t, err)
assert.Equal(t, "test", f.Name)
})
t.Run("Nonexisting", func(t *testing.T) {
f := &File{ID: 9999}
err := f.LoadFileMetaByID()
assert.Error(t, err)
assert.True(t, IsErrFileDoesNotExist(err))
})
}