Micro-service for file storage and processing written in Go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
553 B

  1. package storage
  2. import (
  3. "testing"
  4. "github.com/spf13/afero"
  5. "github.com/stretchr/testify/assert"
  6. )
  7. func TestFileSystemStorageProvider(t *testing.T) {
  8. t.Run("Store method stores files in filesystem", func(t *testing.T) {
  9. fileSystem := afero.NewMemMapFs()
  10. dummyData := []byte{0x13, 0x37}
  11. provider := FileSystemStorageProvider{
  12. fileSystem: fileSystem,
  13. basePath: "/tmp/foo/bar",
  14. }
  15. provider.store("test", "test.bin", dummyData)
  16. exists, _ := afero.Exists(fileSystem, "/tmp/foo/bar/test/test.bin")
  17. assert.True(t, exists)
  18. })
  19. }