mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Auth: Refactor cluster configuration and provisioning API endpoints #98
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -11,37 +11,30 @@ func TestNormalizeExt(t *testing.T) {
|
||||
result := NormalizedExt("testdata/test")
|
||||
assert.Equal(t, "", result)
|
||||
})
|
||||
|
||||
t.Run("dot", func(t *testing.T) {
|
||||
result := NormalizedExt("testdata/test.")
|
||||
assert.Equal(t, "", result)
|
||||
})
|
||||
|
||||
t.Run("test.z", func(t *testing.T) {
|
||||
result := NormalizedExt("testdata/test.z")
|
||||
assert.Equal(t, "z", result)
|
||||
})
|
||||
|
||||
t.Run("test.jpg", func(t *testing.T) {
|
||||
result := NormalizedExt("testdata/test.jpg")
|
||||
assert.Equal(t, "jpg", result)
|
||||
})
|
||||
|
||||
t.Run("test.PNG", func(t *testing.T) {
|
||||
result := NormalizedExt("testdata/test.PNG")
|
||||
assert.Equal(t, "png", result)
|
||||
})
|
||||
|
||||
t.Run("test.MOV", func(t *testing.T) {
|
||||
result := NormalizedExt("testdata/test.MOV")
|
||||
assert.Equal(t, "mov", result)
|
||||
})
|
||||
|
||||
t.Run("test.xmp", func(t *testing.T) {
|
||||
result := NormalizedExt("testdata/test.xMp")
|
||||
assert.Equal(t, "xmp", result)
|
||||
})
|
||||
|
||||
t.Run("test.MP", func(t *testing.T) {
|
||||
result := NormalizedExt("testdata/test.mp")
|
||||
assert.Equal(t, "mp", result)
|
||||
@@ -74,12 +67,10 @@ func TestStripExt(t *testing.T) {
|
||||
result := StripExt("/testdata/Test.jpg")
|
||||
assert.Equal(t, "/testdata/Test", result)
|
||||
})
|
||||
|
||||
t.Run("Test.jpg.json", func(t *testing.T) {
|
||||
result := StripExt("/testdata/Test.jpg.json")
|
||||
assert.Equal(t, "/testdata/Test.jpg", result)
|
||||
})
|
||||
|
||||
t.Run("Test copy 3.foo", func(t *testing.T) {
|
||||
result := StripExt("/testdata/Test copy 3.foo")
|
||||
assert.Equal(t, "/testdata/Test copy 3", result)
|
||||
@@ -91,22 +82,18 @@ func TestStripKnownExt(t *testing.T) {
|
||||
result := StripKnownExt("/testdata/Test.jpg")
|
||||
assert.Equal(t, "/testdata/Test", result)
|
||||
})
|
||||
|
||||
t.Run("Test.jpg.json", func(t *testing.T) {
|
||||
result := StripKnownExt("/testdata/Test.jpg.json")
|
||||
assert.Equal(t, "/testdata/Test", result)
|
||||
})
|
||||
|
||||
t.Run("Test copy 3.foo", func(t *testing.T) {
|
||||
result := StripKnownExt("/testdata/Test copy 3.foo")
|
||||
assert.Equal(t, "/testdata/Test copy 3.foo", result)
|
||||
})
|
||||
|
||||
t.Run("my/file.jpg.json.xmp", func(t *testing.T) {
|
||||
result := StripKnownExt("my/file.jpg.json.xmp")
|
||||
assert.Equal(t, "my/file", result)
|
||||
})
|
||||
|
||||
t.Run("my/jpg/avi.foo.bar.baz", func(t *testing.T) {
|
||||
result := StripKnownExt("my/jpg/avi.foo.bar.baz")
|
||||
assert.Equal(t, "my/jpg/avi.foo.bar.baz", result)
|
||||
@@ -134,17 +121,14 @@ func TestExt(t *testing.T) {
|
||||
result := Ext("/testdata/Test.jpg")
|
||||
assert.Equal(t, ".jpg", result)
|
||||
})
|
||||
|
||||
t.Run("Test.jpg.json", func(t *testing.T) {
|
||||
result := Ext("/testdata/Test.jpg.json")
|
||||
assert.Equal(t, ".jpg.json", result)
|
||||
})
|
||||
|
||||
t.Run("Test copy 3.foo", func(t *testing.T) {
|
||||
result := Ext("/testdata/Test copy 3.foo")
|
||||
assert.Equal(t, ".foo", result)
|
||||
})
|
||||
|
||||
t.Run("Test", func(t *testing.T) {
|
||||
result := Ext("/testdata/Test")
|
||||
assert.Equal(t, "", result)
|
||||
|
||||
Reference in New Issue
Block a user