From d45753b5bc75c372267ab93b6cd7f42663cd1758 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Sun, 3 Jul 2016 22:53:58 +0200 Subject: [PATCH] add test for custom contents --- test/test_content/customzipped.control | 1 + test/test_content/customzipped.source | 4 ++++ .../datadir/python/content/customzipedplugin.py | 15 +++++++++++++++ .../datadir_zippedcontent/python/content | Bin 0 -> 420 bytes test/test_content/test_content.py | 2 +- 5 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 test/test_content/customzipped.control create mode 100644 test/test_content/customzipped.source create mode 100755 test/test_content/datadir/python/content/customzipedplugin.py create mode 100644 test/test_content/datadir_zippedcontent/python/content diff --git a/test/test_content/customzipped.control b/test/test_content/customzipped.control new file mode 100644 index 00000000..6d3fd533 --- /dev/null +++ b/test/test_content/customzipped.control @@ -0,0 +1 @@ +- "{'customzippedname:': ''}" \ No newline at end of file diff --git a/test/test_content/customzipped.source b/test/test_content/customzipped.source new file mode 100644 index 00000000..f94689e6 --- /dev/null +++ b/test/test_content/customzipped.source @@ -0,0 +1,4 @@ +- addsongdir: + path: "datadir_sort" + content: + - customzippedname: diff --git a/test/test_content/datadir/python/content/customzipedplugin.py b/test/test_content/datadir/python/content/customzipedplugin.py new file mode 100755 index 00000000..1d20b777 --- /dev/null +++ b/test/test_content/datadir/python/content/customzipedplugin.py @@ -0,0 +1,15 @@ +"""Fake plugin for test purposes.""" + +from patacrep.content import ContentItem, ContentList, validate_parser_argument + +class FakeContent(ContentItem): + """Fake content.""" + + def file_entry(self): + return {'customzippedname:':''} + +def parse(keyword, argument, config): + return ContentList([FakeContent()]) + +CONTENT_PLUGINS = {'customzipedname': parse} + diff --git a/test/test_content/datadir_zippedcontent/python/content b/test/test_content/datadir_zippedcontent/python/content new file mode 100644 index 0000000000000000000000000000000000000000..a333d318a650a18aa11e723f9930df3f4a98577d GIT binary patch literal 420 zcmWIWW@Zs#U|`^2__F1(M{;Ia(GwuAkdc8wltG3exwN<>KesBgpddA+Ag44vGf%Ie zGBkvfftjbGGMo>HODnh;7+GF0GcbUO+r@==*=~-Y*@JZ!Ze2hZqM+g z5{dmi9jTocHB@!?R)VJDw@x%Y>NkMiixtr!c%1FD=*I;Py!{Z(+kG1Affmw4{ z*GGJ9sk^>=W?`DaHS44s>t8osy!QQR2GjL|(8-b_$FEEKQ{4CLWO+^R9DT)dIqgj8&aBVNKh?gDsSR;@6MyS-a`n5o{`~Xp-&pwnFX&EF z)%y}3;LXS+$BZk`B!I!kzyJ(ChPRC%7LFifg#;m5@CA6YvVk-)0%0_eHU^o)004f8 Boo)aC literal 0 HcmV?d00001 diff --git a/test/test_content/test_content.py b/test/test_content/test_content.py index bd429bf8..5edb9f96 100644 --- a/test/test_content/test_content.py +++ b/test/test_content/test_content.py @@ -101,7 +101,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): # Load the default songbook config config = prepare_songbook( - {'book':{'datadir':'datadir'}, 'content': sbcontent}, + {'book':{'datadir':['datadir', 'datadir_zippedcontent']}, 'content': sbcontent}, outputdir, base, outputdir