From 26917e4b27cef0219c65b6f5c0466283025e1e39 Mon Sep 17 00:00:00 2001 From: Matthias Hannig Date: Tue, 26 Jun 2018 00:08:51 +0200 Subject: [PATCH] fixed theme tests --- backend/theme_test.go | 48 ++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/backend/theme_test.go b/backend/theme_test.go index a7d69fc..797dfb5 100644 --- a/backend/theme_test.go +++ b/backend/theme_test.go @@ -2,8 +2,10 @@ package main import ( "io/ioutil" - "os" "path/filepath" + + "os" + "strings" "testing" ) @@ -12,33 +14,6 @@ func touchFile(path, filename string) error { return ioutil.WriteFile(target, []byte{}, 0644) } -func TestThemeLoading(t *testing.T) { - themePath, err := ioutil.TempDir("", "alice-lg-tmp-theme") - if err != nil { - t.Error(err) - } - defer os.RemoveAll(themePath) - - // This should work aswell, as themes are optional - _, err = NewTheme(ThemeConfig{ - BasePath: "/theme", - Path: themePath, - }) - - if err != nil { - t.Error(err) - } - - // This should not: - _, err = NewTheme(ThemeConfig{ - Path: "/1ade5e183fd7b84a1590ad7144dbd6e0caed1b6a", - }) - - if err == nil { - t.Error("Expected the theme loading to fail with unknown path.") - } -} - func TestThemeFiles(t *testing.T) { themePath, err := ioutil.TempDir("", "alice-lg-tmp-theme") if err != nil { @@ -124,4 +99,21 @@ func TestThemeIncludes(t *testing.T) { stylesHtml := theme.StylesheetIncludes() scriptsHtml := theme.ScriptIncludes() + if !strings.HasPrefix(scriptsHtml, "