mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-03 19:00:05 -06:00
* enhancement: introduce theme processing * enhancement: introduce theme processing * enhancement: add theme processing tests and changelog * Update services/web/pkg/config/config.go Co-authored-by: Michael Barz <michael.barz@zeitgestalten.eu> * fix: ci findings * Apply suggestions from code review Co-authored-by: Martin <github@diemattels.at> * enhancement: use the theme assets from web instead of having them inside the oCis repo (license clash Apache vs. AGPLv3) * fix: golangci tagalign order * fix: rename UnifiedRoleUploader to UnifiedRoleEditorLite * fix: some typos Co-authored-by: Michael Barz <michael.barz@zeitgestalten.eu> * enhancement: export supported theme logo upload filetypes * chore: bump reva * fix: allow init func --------- Co-authored-by: Michael Barz <michael.barz@zeitgestalten.eu> Co-authored-by: Martin <github@diemattels.at>
31 lines
833 B
Go
31 lines
833 B
Go
package theme_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/owncloud/ocis/v2/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)
|
|
}
|
|
}
|