Files
photoprism/pkg/txt/log_test.go
2025-10-02 15:03:47 +02:00

44 lines
1.3 KiB
Go

package txt
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestLogParam(t *testing.T) {
t.Run("TheQuickBrownFox", func(t *testing.T) {
assert.Equal(t, "'The quick brown fox.'", LogParam("The quick brown fox."))
})
t.Run("FilenameTxt", func(t *testing.T) {
assert.Equal(t, "filename.txt", LogParam("filename.txt"))
})
t.Run("EmptyString", func(t *testing.T) {
assert.Equal(t, "''", LogParam(""))
})
t.Run("Log4j", func(t *testing.T) {
assert.Equal(t, "??https://?host?:?port?/?path??", LogParam("${https://<host>:<port>/<path>}"))
})
t.Run("Log4j", func(t *testing.T) {
assert.Equal(t, "?", LogParam("User-Agent: ${jndi:ldap://<host>:<port>/<path>}"))
})
}
func TestLogParamLower(t *testing.T) {
t.Run("TheQuickBrownFox", func(t *testing.T) {
assert.Equal(t, "'the quick brown fox.'", LogParamLower("The quick brown fox."))
})
t.Run("FilenameTxt", func(t *testing.T) {
assert.Equal(t, "filename.txt", LogParamLower("filename.TXT"))
})
t.Run("EmptyString", func(t *testing.T) {
assert.Equal(t, "''", LogParamLower(""))
})
t.Run("Log4j", func(t *testing.T) {
assert.Equal(t, "??https://?host?:?port?/?path??", LogParamLower("${https://<host>:<port>/<path>}"))
})
t.Run("Log4j", func(t *testing.T) {
assert.Equal(t, "?", LogParamLower("User-Agent: ${jndi:ldap://<host>:<port>/<path>}"))
})
}