Files
photoprism/internal/api/cache_test.go
Michael Mayer 1f4f65e988 Server: Add "force" and "mode" flags for sockets #4673 #4767 #4765 #4467
These changes allow you to force the re-creation of existing Unix domain
sockets and set the permissions of sockets after they have been created.

The flag or variable value for this must be formatted as follows:
--http-host="unix:/var/run/photoprism.sock?force=true&mode=660"

Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-02-04 12:03:00 +01:00

31 lines
718 B
Go

package api
import (
"net/http/httptest"
"testing"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/photoprism/photoprism/pkg/net/header"
)
func TestAddVideoCacheHeader(t *testing.T) {
t.Run("Public", func(t *testing.T) {
r := httptest.NewRecorder()
c, _ := gin.CreateTestContext(r)
AddVideoCacheHeader(c, true)
h := r.Header()
s := h[header.CacheControl][0]
assert.Equal(t, "public, max-age=21600, immutable", s)
})
t.Run("Private", func(t *testing.T) {
r := httptest.NewRecorder()
c, _ := gin.CreateTestContext(r)
AddVideoCacheHeader(c, false)
h := r.Header()
s := h[header.CacheControl][0]
assert.Equal(t, "private, max-age=21600, immutable", s)
})
}