Browse Source

add custom plugins tests

pull/235/head
Oliverpool 8 years ago
parent
commit
5fb242f421
  1. 1
      test/test_content/custom.control
  2. 1
      test/test_content/custom.source
  3. 21
      test/test_content/datadir/python/content/customplugin.py
  4. 2
      test/test_content/test_content.py

1
test/test_content/custom.control

@ -0,0 +1 @@
- "{'customname:': ''}"

1
test/test_content/custom.source

@ -0,0 +1 @@
- customname:

21
test/test_content/datadir/python/content/customplugin.py

@ -0,0 +1,21 @@
"""Fake plugin for test purposes."""
from patacrep.content import ContentItem, ContentList, validate_parser_argument
class FakeContent(ContentItem):
"""Fake content."""
def render(self, __context):
return 'fakecontent'
def file_entry(self):
return {'customname:':''}
#pylint: disable=unused-argument
def parse(keyword, argument, config):
"""
"""
return ContentList([FakeContent()])
CONTENT_PLUGINS = {'customname': parse}

2
test/test_content/test_content.py

@ -93,7 +93,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest):
return files.path2posix(elem.filename)
else:
raise Exception(elem)
return str(elem.file_entry())
@classmethod
def _generate_config(cls, sbcontent, outputdir, base):

Loading…
Cancel
Save