Pkg: Add service/cluster package & rename media/http → service/http #98

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-09-13 12:58:28 +02:00
parent 3f11165f61
commit 023fbe3a1d
154 changed files with 354 additions and 236 deletions

View File

@@ -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).