mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-26 15:50:47 -05:00
31 lines
839 B
Go
31 lines
839 B
Go
package theme_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/opencloud-eu/opencloud/services/web/pkg/theme"
|
|
)
|
|
|
|
// TestAllowedLogoFileTypes is here to ensure that a certain set of bare minimum file types are allowed for logos.
|
|
func TestAllowedLogoFileTypes(t *testing.T) {
|
|
type test struct {
|
|
filename string
|
|
mimetype string
|
|
allowed bool
|
|
}
|
|
|
|
tests := []test{
|
|
{filename: "foo.jpg", mimetype: "image/jpeg", allowed: true},
|
|
{filename: "foo.jpeg", mimetype: "image/jpeg", allowed: true},
|
|
{filename: "foo.png", mimetype: "image/png", allowed: true},
|
|
{filename: "foo.gif", mimetype: "image/gif", allowed: true},
|
|
{filename: "foo.tiff", mimetype: "image/tiff", allowed: false},
|
|
}
|
|
|
|
for _, tc := range tests {
|
|
assert.Equal(t, theme.IsFiletypePermitted(tc.filename, tc.mimetype), tc.allowed)
|
|
}
|
|
}
|