2020-05-14 15:04:53 +02:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2020-11-21 18:08:41 +01:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2020-05-14 15:04:53 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestFileShareMap_Get(t *testing.T) {
|
|
|
|
t.Run("get existing fileshare", func(t *testing.T) {
|
|
|
|
r := FileShareFixtures.Get("FileShare1", 0, 0, "")
|
2022-10-15 21:54:11 +02:00
|
|
|
assert.Equal(t, uint(1000000), r.ServiceID)
|
2021-07-22 15:05:23 +02:00
|
|
|
assert.Equal(t, "/20100729-015747-Urlaub-2010.jpg", r.RemoteName)
|
2020-05-14 15:04:53 +02:00
|
|
|
assert.IsType(t, FileShare{}, r)
|
|
|
|
})
|
|
|
|
t.Run("get not existing fileshare", func(t *testing.T) {
|
|
|
|
r := FileShareFixtures.Get("FileShareXXX", 123, 888, "new remote name")
|
2022-10-15 21:54:11 +02:00
|
|
|
assert.Equal(t, uint(888), r.ServiceID)
|
2020-05-14 15:04:53 +02:00
|
|
|
assert.Equal(t, "new remote name", r.RemoteName)
|
|
|
|
assert.IsType(t, FileShare{}, r)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestFileShareMap_Pointer(t *testing.T) {
|
|
|
|
t.Run("get existing fileshare pointer", func(t *testing.T) {
|
|
|
|
r := FileShareFixtures.Pointer("FileShare1", 0, 0, "")
|
2022-10-15 21:54:11 +02:00
|
|
|
assert.Equal(t, uint(1000000), r.ServiceID)
|
2021-07-22 15:05:23 +02:00
|
|
|
assert.Equal(t, "/20100729-015747-Urlaub-2010.jpg", r.RemoteName)
|
2020-05-14 15:04:53 +02:00
|
|
|
assert.IsType(t, &FileShare{}, r)
|
|
|
|
})
|
|
|
|
t.Run("get not existing fileshare pointer", func(t *testing.T) {
|
|
|
|
r := FileShareFixtures.Pointer("FileShareYYY", 456, 889, "new remote name for pointer")
|
2022-10-15 21:54:11 +02:00
|
|
|
assert.Equal(t, uint(889), r.ServiceID)
|
2020-05-14 15:04:53 +02:00
|
|
|
assert.Equal(t, "new remote name for pointer", r.RemoteName)
|
|
|
|
assert.IsType(t, &FileShare{}, r)
|
|
|
|
})
|
|
|
|
}
|