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
|
from xml.dom import minidom
|
||||||
|
|
||||||
workdir = 'tests/work/apply'
|
workdir = 'tests/work/apply'
|
||||||
configfile = 'tests/data/apply/config.ini'
|
configfile = 'tests/data/apply/config-%s.ini'
|
||||||
testfeed = 'tests/data/apply/feed.xml'
|
testfeed = 'tests/data/apply/feed.xml'
|
||||||
|
|
||||||
class ApplyTest(unittest.TestCase):
|
class ApplyTest(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
testfile = open(testfeed)
|
||||||
|
self.feeddata = testfile.read()
|
||||||
|
testfile.close()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.makedirs(workdir)
|
os.makedirs(workdir)
|
||||||
except:
|
except:
|
||||||
@ -20,13 +24,9 @@ class ApplyTest(unittest.TestCase):
|
|||||||
shutil.rmtree(workdir)
|
shutil.rmtree(workdir)
|
||||||
os.removedirs(os.path.split(workdir)[0])
|
os.removedirs(os.path.split(workdir)[0])
|
||||||
|
|
||||||
def test_apply(self):
|
def test_apply_asf(self):
|
||||||
testfile = open(testfeed)
|
config.load(configfile % 'asf')
|
||||||
feeddata = testfile.read()
|
splice.apply(self.feeddata)
|
||||||
testfile.close()
|
|
||||||
|
|
||||||
config.load(configfile)
|
|
||||||
splice.apply(feeddata)
|
|
||||||
|
|
||||||
# verify that selected files are there
|
# verify that selected files are there
|
||||||
for file in ['index.html', 'default.css', 'images/foaf.png']:
|
for file in ['index.html', 'default.css', 'images/foaf.png']:
|
||||||
@ -46,3 +46,19 @@ class ApplyTest(unittest.TestCase):
|
|||||||
html.close()
|
html.close()
|
||||||
self.assertEqual(3, lang)
|
self.assertEqual(3, lang)
|
||||||
self.assertEqual(12, content)
|
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