2019-05-06 23:18:10 +02:00
|
|
|
package config
|
2019-05-03 18:57:28 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/jinzhu/gorm"
|
2019-05-06 23:18:10 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/util"
|
2019-05-03 18:57:28 +02:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestTestCliContext(t *testing.T) {
|
|
|
|
result := CliTestContext()
|
|
|
|
|
|
|
|
assert.IsType(t, new(cli.Context), result)
|
|
|
|
}
|
|
|
|
|
2019-05-06 23:18:10 +02:00
|
|
|
func TestTestConfig(t *testing.T) {
|
|
|
|
result := TestConfig()
|
2019-05-03 18:57:28 +02:00
|
|
|
|
2019-05-06 23:18:10 +02:00
|
|
|
assert.IsType(t, new(Config), result)
|
2019-05-03 18:57:28 +02:00
|
|
|
}
|
|
|
|
|
2019-05-06 23:18:10 +02:00
|
|
|
func TestNewTestParams(t *testing.T) {
|
|
|
|
c := NewTestParams()
|
2019-05-03 18:57:28 +02:00
|
|
|
|
2019-05-06 23:18:10 +02:00
|
|
|
assert.IsType(t, new(Params), c)
|
2019-05-03 18:57:28 +02:00
|
|
|
|
2019-05-06 23:18:10 +02:00
|
|
|
assert.Equal(t, util.ExpandedFilename("../../assets"), c.AssetsPath)
|
2019-05-03 18:57:28 +02:00
|
|
|
assert.False(t, c.Debug)
|
|
|
|
}
|
|
|
|
|
2019-05-06 23:18:10 +02:00
|
|
|
func TestNewTestConfig(t *testing.T) {
|
|
|
|
c := NewTestConfig()
|
2019-05-03 18:57:28 +02:00
|
|
|
|
|
|
|
db := c.Db()
|
|
|
|
|
|
|
|
assert.IsType(t, &gorm.DB{}, db)
|
|
|
|
}
|