photoprism/internal/hub/config_test.go
Michael Mayer 49be9b873e Config: Propagate backend session status
Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-07-14 22:35:42 +02:00

29 lines
828 B
Go

package hub
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestConfig_MapKey(t *testing.T) {
t.Run("success", func(t *testing.T) {
c := NewConfig("0.0.0", "testdata/new.yml", "zqkunt22r0bewti9", "test", "PhotoPrism/Test", "test")
assert.Equal(t, "", c.MapKey())
})
}
func TestConfig_Plus(t *testing.T) {
t.Run("Status", func(t *testing.T) {
c := NewConfig("0.0.0", "testdata/new.yml", "zqkunt22r0bewti9", "test", "PhotoPrism/Test", "test")
assert.False(t, c.Plus())
c.Status = StatusPlus
assert.False(t, c.Plus())
c.Session = "bde6d0cf514e5456591de5ae09d981056eb88dccf71ba268974bf2cc7b028545e7641c1dfbaa716e4d13f8b0e0d1863e64c16e1f0ac551fc85e1171a87cbda6608cbe330de9e0d5f5b0e14ff61f2ff08fee369"
assert.True(t, c.Plus())
c.Status = ""
assert.False(t, c.Plus())
c.Session = ""
})
}