mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Pkg: Add service/cluster package & rename media/http → service/http #98
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -12,14 +12,15 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/photoprism/photoprism/pkg/fs"
|
||||
"github.com/photoprism/photoprism/pkg/media/http/header"
|
||||
"github.com/photoprism/photoprism/pkg/service/cluster"
|
||||
"github.com/photoprism/photoprism/pkg/service/http/header"
|
||||
)
|
||||
|
||||
func TestClusterGetTheme(t *testing.T) {
|
||||
t.Run("FeatureDisabled", func(t *testing.T) {
|
||||
app, router, conf := NewApiTest()
|
||||
// Ensure portal feature flag is disabled.
|
||||
conf.Options().ClusterPortal = false
|
||||
conf.Options().NodeType = cluster.Instance
|
||||
ClusterGetTheme(router)
|
||||
|
||||
r := PerformRequest(app, http.MethodGet, "/api/v1/cluster/theme")
|
||||
@@ -29,7 +30,7 @@ func TestClusterGetTheme(t *testing.T) {
|
||||
t.Run("NotFound", func(t *testing.T) {
|
||||
app, router, conf := NewApiTest()
|
||||
// Enable portal feature flag for this endpoint.
|
||||
conf.Options().ClusterPortal = true
|
||||
conf.Options().NodeType = cluster.Portal
|
||||
ClusterGetTheme(router)
|
||||
|
||||
missing := filepath.Join(os.TempDir(), "photoprism-test-missing-theme")
|
||||
@@ -47,7 +48,7 @@ func TestClusterGetTheme(t *testing.T) {
|
||||
t.Run("Success", func(t *testing.T) {
|
||||
app, router, conf := NewApiTest()
|
||||
// Enable portal feature flag for this endpoint.
|
||||
conf.Options().ClusterPortal = true
|
||||
conf.Options().NodeType = cluster.Portal
|
||||
ClusterGetTheme(router)
|
||||
|
||||
tempTheme, err := os.MkdirTemp("", "pp-theme-*")
|
||||
@@ -102,7 +103,7 @@ func TestClusterGetTheme(t *testing.T) {
|
||||
t.Run("Empty", func(t *testing.T) {
|
||||
app, router, conf := NewApiTest()
|
||||
// Enable portal feature flag for this endpoint.
|
||||
conf.Options().ClusterPortal = true
|
||||
conf.Options().NodeType = cluster.Portal
|
||||
ClusterGetTheme(router)
|
||||
|
||||
// Create an empty temporary theme directory (no includable files).
|
||||
|
||||
Reference in New Issue
Block a user