summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2017-01-20 05:10:45 +0000
committerrsiddharth <s@ricketyspace.net>2017-01-20 05:10:45 +0000
commita295268af9a8df2e48c6bb772f7df876f4459883 (patch)
tree665c6c04a268a067b66ecbd6bedcf0b94a3f25fb /tests
parentba0568d39f47233b185262b1b00bc0581d276001 (diff)
Add `read_wiki_page` function.
* gd_diff.py (read_wiki_page): New function. * tests/test_gd_diff.py (test_read_wiki_page_returns_none_if_wikipage_nonexistent) (test_read_wiki_page_returns_content_if_wikipage_existent): Tests for `read_wiki_page`.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gd_diff.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_gd_diff.py b/tests/test_gd_diff.py
index b4c0b6b..1dd0b5f 100644
--- a/tests/test_gd_diff.py
+++ b/tests/test_gd_diff.py
@@ -477,6 +477,25 @@ class TestGdDiff(object):
assert wiki_page == gns_wiki_header() + '\n' + wiki_table
+ def test_read_wiki_page_returns_none_if_wikipage_nonexistent(self):
+ with mock.patch('os.getenv', new=self.env_func):
+ wiki_page_content = read_wiki_page('bogus-release')
+ assert wiki_page_content == None
+
+
+ def test_read_wiki_page_returns_content_if_wikipage_existent(self):
+ with mock.patch('os.getenv', new=self.env_func):
+ wp_file = wiki_page_path('bogus-release')
+
+ # write some bogus content
+ bogus_content = 'bogus content'
+ with open(wp_file, 'w') as f:
+ f.write(bogus_content)
+
+ wiki_page_content = read_wiki_page('bogus-release')
+ assert wiki_page_content == bogus_content
+
+
def test_push_wiki_page(self):
url = 'http://localhost:8080'
user = 's'