소스 검색

ah, tags are now tested too

Oz N Tiram 9 년 전
부모
커밋
5255609a6e
2개의 변경된 파일12개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      blogit/blogit.py
  2. 11 4
      tests/test_all.py

+ 1 - 1
blogit/blogit.py

@@ -209,7 +209,7 @@ class Entry(object):
         try:
             self.prepare()
         except KeyError as E:
-            import pdb; pdb.set_trace()
+            pass
 
     def __str__(self):
         return self.path

+ 11 - 4
tests/test_all.py

@@ -44,7 +44,7 @@ tags: {tags}
 public: yes
 chronological: yes
 kind: writing
-summary: This is a summry of post {number}. Donec id elit non mi porta gravida at eget metus. Fusce dapibus
+summary: This is a summray of post {number}. Donec id elit non mi porta gravida at eget metus. Fusce dapibus
 ---
 
 This is the body of post {number}. Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
@@ -194,7 +194,7 @@ published: 2015-01-{}
 public: yes
 chronological: yes
 kind: writing
-summary: This is a summry
+summary: This is a summary
 ---
 """
     with open(os.path.join(CONFIG['content_root'], 'e.md'), 'w') as f:
@@ -269,5 +269,12 @@ def test_build():
         soup = BeautifulSoup(html_index.read(), 'html.parser')
         assert len(soup.find_all(class_='post')) == 12
 
-    # todo, check tag pages
-    # tag pages are not built properly
+    with open(os.path.join(CONFIG['output_to'], 'tags', 'foo', 'index.html')) as tag_foo:
+        soup = BeautifulSoup(tag_foo.read(), 'html.parser')
+        titles = [c.a.string for c in
+                  soup.find_all(class_="clearfix entry")]
+        for title, idx in zip(titles, range(15, 0, -1)):
+            assert title.split()[-1] == str(idx)
+
+
+