Browse Source

add some more meat to the tests

Oz N Tiram 9 years ago
parent
commit
6977e1f65c
2 changed files with 82 additions and 12 deletions
  1. 56 9
      tests/test_blogit.py
  2. 26 3
      tests/test_tag.py

+ 56 - 9
tests/test_blogit.py

@@ -5,7 +5,7 @@ from blogit.blogit import find_new_posts, DataBase, Entry, Tag
 from blogit.blogit import CONFIG, new_build
 
 
-post_dummy = """title: Blog post {}
+post_dummy = """title: Blog post{}
 author: Famous author
 published: 2015-01-1{}
 tags: [python, git, bash, linux]
@@ -13,11 +13,35 @@ public: yes
 chronological: yes
 kind: writing
 summary: |
-    This is a summry of post {}
+    This is a summry of post {}. Donec id elit non mi porta gravida at eget metus. Fusce dapibus
     ...
 
-This is the body of post {}
+This is the body of post {}. 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.
+
+This is a snippet in bash
+
+```bash
+$ for i in `seq 1 10`; do
+   echo $i
+done
+
+VAR="variable"
+echo
+```
+
+This is a snippet in python
+
+```python
+def yay(top):
+        for i in range(1, top+1):
+                    yield i
+
+    for i in yay:
+        print(i)
+```
+This the last line of the post.
 """
+
 def insert_single(DB):
     Posts = Query()
     if not DB.posts.contains(Posts.filename == 'post4.md'):
@@ -29,7 +53,7 @@ def create_posts():
     os.chdir('content')
     for p in range(1,4):
         with open('post'+str(p)+'.md', 'a') as f:
-            f.write(post_dummy.format(p,p,p))
+            f.write(post_dummy.format(p,p,p,p))
     os.chdir('..')
 
 def clean_posts():
@@ -64,21 +88,44 @@ def test_new_build():
 
 post_dummy = """title: Blog post {}
 author: Famous author
-published: 2015-01-16
-tags: [python, git, foo]
+published: 2015-01-1{}
+tags: [python, git, bash, linux]
 public: yes
 chronological: yes
 kind: writing
 summary: |
-    This is a summry of post {}
+    This is a summry of post {}. Donec id elit non mi porta gravida at eget metus. Fusce dapibus
     ...
 
-This is the body of post {}
+This is the body of post {}. 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.
+
+This is a snippet in bash
+
+```bash
+$ for i in `seq 1 10`; do
+   echo $i
+done
+
+VAR="variable"
+echo $VAR
+```
+
+This is a snippet in python
+
+```python
+def yay(top):
+    for i in range(1, top+1):
+		yield i
+
+for i in yay:
+    print(i)
+```
 """
+
 def create_last_post():
     os.chdir('content')
     with open('post'+str(5)+'.md', 'a') as f:
-        f.write(post_dummy.format(5,5,5))
+        f.write(post_dummy.format(5,5,5,5))
     os.chdir('..')
 
 def test_new_build2():

+ 26 - 3
tests/test_tag.py

@@ -13,10 +13,33 @@ public: yes
 chronological: yes
 kind: writing
 summary: |
-    This is a summry of post {}
-     ...
+    This is a summry of post {}. Donec id elit non mi porta gravida at eget metus. Fusce dapibus
+    ...
 
-This is the body of post {}
+This is the body of post {}. 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. 
+
+This is a snippet in bash
+
+```bash
+$ for i in `seq 1 10`; do
+   echo $i
+done
+
+VAR="variable"
+echo ${VAR}
+```
+
+This is a snippet in python
+
+```
+def yay(top):
+    for i in range(1, top+1):
+		yield i
+```
+
+for i in yay:
+    print(i)
+```
 """
 
 def create_posts():