mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-11 16:24:11 +01:00
44 lines
1.3 KiB
Go
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>}"))
|
|
})
|
|
}
|