Test case for fancy theme
This commit is contained in:
parent
89a8d73cba
commit
f338e293ae
21
tests/data/apply/config-fancy.ini
Normal file
21
tests/data/apply/config-fancy.ini
Normal file
@ -0,0 +1,21 @@
|
||||
[Planet]
|
||||
output_theme = classic_fancy
|
||||
output_dir = tests/work/apply
|
||||
name = test planet
|
||||
cache_directory = tests/work/spider/cache
|
||||
|
||||
bill_of_materials:
|
||||
images/#{face}
|
||||
|
||||
[tests/data/spider/testfeed0.atom]
|
||||
name = not found
|
||||
|
||||
[tests/data/spider/testfeed1b.atom]
|
||||
name = one
|
||||
face = jdub.png
|
||||
|
||||
[tests/data/spider/testfeed2.atom]
|
||||
name = two
|
||||
|
||||
[tests/data/spider/testfeed3.rss]
|
||||
name = three
|
BIN
tests/data/apply/images/jdub.png
Normal file
BIN
tests/data/apply/images/jdub.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.6 KiB |
@ -5,11 +5,15 @@ from planet import config, splice
|
||||
from xml.dom import minidom
|
||||
|
||||
workdir = 'tests/work/apply'
|
||||
configfile = 'tests/data/apply/config.ini'
|
||||
configfile = 'tests/data/apply/config-%s.ini'
|
||||
testfeed = 'tests/data/apply/feed.xml'
|
||||
|
||||
class ApplyTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
testfile = open(testfeed)
|
||||
self.feeddata = testfile.read()
|
||||
testfile.close()
|
||||
|
||||
try:
|
||||
os.makedirs(workdir)
|
||||
except:
|
||||
@ -20,13 +24,9 @@ class ApplyTest(unittest.TestCase):
|
||||
shutil.rmtree(workdir)
|
||||
os.removedirs(os.path.split(workdir)[0])
|
||||
|
||||
def test_apply(self):
|
||||
testfile = open(testfeed)
|
||||
feeddata = testfile.read()
|
||||
testfile.close()
|
||||
|
||||
config.load(configfile)
|
||||
splice.apply(feeddata)
|
||||
def test_apply_asf(self):
|
||||
config.load(configfile % 'asf')
|
||||
splice.apply(self.feeddata)
|
||||
|
||||
# verify that selected files are there
|
||||
for file in ['index.html', 'default.css', 'images/foaf.png']:
|
||||
@ -46,3 +46,19 @@ class ApplyTest(unittest.TestCase):
|
||||
html.close()
|
||||
self.assertEqual(3, lang)
|
||||
self.assertEqual(12, content)
|
||||
|
||||
def test_apply_fancy(self):
|
||||
config.load(configfile % 'fancy')
|
||||
splice.apply(self.feeddata)
|
||||
|
||||
# verify that selected files are there
|
||||
for file in ['index.html', 'planet.css', 'images/jdub.png']:
|
||||
path = os.path.join(workdir, file)
|
||||
self.assertTrue(os.path.exists(path), path)
|
||||
self.assertTrue(os.stat(path).st_size > 0)
|
||||
|
||||
# verify that index.html is well formed, has content, and xml:lang
|
||||
html = open(os.path.join(workdir, 'index.html')).read()
|
||||
self.assertTrue('<h1>test planet</h1>' in html)
|
||||
self.assertTrue('<h4><a href="http://example.com/2">Venus</a></h4>'
|
||||
in html)
|
||||
|
Loading…
x
Reference in New Issue
Block a user