2020-12-04 13:10:32 +01:00
|
|
|
package hub
|
2020-10-20 11:05:02 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2020-11-21 18:08:41 +01:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2020-10-20 11:05:02 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestConfig_MapKey(t *testing.T) {
|
|
|
|
t.Run("success", func(t *testing.T) {
|
2022-03-02 14:16:49 +01:00
|
|
|
c := NewConfig("0.0.0", "testdata/new.yml", "zqkunt22r0bewti9", "test", "PhotoPrism/Test", "test")
|
2020-10-20 11:05:02 +02:00
|
|
|
assert.Equal(t, "", c.MapKey())
|
|
|
|
})
|
|
|
|
}
|
2022-07-14 22:35:42 +02:00
|
|
|
|
2023-03-24 19:35:29 +01:00
|
|
|
func TestConfig_Sponsor(t *testing.T) {
|
2022-07-14 22:35:42 +02:00
|
|
|
t.Run("Status", func(t *testing.T) {
|
2022-07-14 23:34:54 +02:00
|
|
|
c := NewConfig("0.0.0", "testdata/new.yml", "zr58wrg19i8jfjam", "test", "PhotoPrism/Test", "test")
|
|
|
|
c.Key = "0e159b773c6fb779c3bf6c8ba6e322abf559dbaf"
|
|
|
|
c.Secret = "23f0024975bd65ade06edcc8191f7fcc"
|
2023-03-24 19:35:29 +01:00
|
|
|
assert.False(t, c.Sponsor())
|
|
|
|
c.Status = "sponsor"
|
|
|
|
assert.False(t, c.Sponsor())
|
2022-07-14 22:35:42 +02:00
|
|
|
c.Session = "bde6d0cf514e5456591de5ae09d981056eb88dccf71ba268974bf2cc7b028545e7641c1dfbaa716e4d13f8b0e0d1863e64c16e1f0ac551fc85e1171a87cbda6608cbe330de9e0d5f5b0e14ff61f2ff08fee369"
|
2023-03-24 19:35:29 +01:00
|
|
|
assert.True(t, c.Sponsor())
|
2022-07-14 22:35:42 +02:00
|
|
|
c.Status = ""
|
2023-03-24 19:35:29 +01:00
|
|
|
assert.False(t, c.Sponsor())
|
2022-07-14 22:35:42 +02:00
|
|
|
c.Session = ""
|
|
|
|
})
|
|
|
|
}
|