gns-deb-diff

automate the documentation of the differences between gNewSense and Debian.
git clone git://git.ricketyspace.net/gns-deb-diff.git
Log | Files | Refs

commit e46931f435cf00f1d70a6a6ccb755b92b7eff441
parent f61cc88f69509c0d448d4c45960fb17d137b21e1
Author: rsiddharth <s@ricketyspace.net>
Date:   Fri,  6 Jan 2017 01:09:06 +0000

Add `wiki_page_path` function.

* gd_diff.py (wiki_page_path): New function.
(write_wiki_page): Update function; use `wiki_page_path` function.
* tests/test_gd_diff.py (TestGdDiff.test_wiki_page_path): Test for
  `wiki_page_path`.
(test_write_wiki_page): Update test.

Diffstat:
gd_diff.py | 11+++++++++--
tests/test_gd_diff.py | 10+++++++++-
2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/gd_diff.py b/gd_diff.py @@ -212,6 +212,14 @@ def wiki_page_dir(release): return wd_release +def wiki_page_path(release): + """Returns the path to file that contains wiki page for `release`. + + """ + wd_release = wiki_page_dir(release) + return os.path.join(wd_release, 'wiki.page') + + def configured_p(): """Returns True if gns-deb-diff is configured; False otherwise. """ @@ -398,8 +406,7 @@ def write_wiki_page(release, content): """Write wiki page `content` to `release`' last.rev file. """ - wd_release = wiki_page_dir(release) - wp_file = os.path.join(wd_release, 'last.rev') + wp_file = wiki_page_path(release) write_file(wp_file, content) diff --git a/tests/test_gd_diff.py b/tests/test_gd_diff.py @@ -179,11 +179,19 @@ class TestGdDiff(object): assert_equal(os.path.isdir(wd_parkes), True) + def test_wiki_page_path(self): + with mock.patch('os.getenv', new=self.env_func): + assert_equal(wiki_page_path('parkes'), + path.join(os.getenv('HOME'), '.config', + 'gns-deb-diff', 'wiki-page', + 'parkes', 'wiki.page')) + + def test_write_wiki_page(self): with mock.patch('os.getenv', new=self.env_func): release = 'parkes' write_wiki_page(release, 'wiki content') - wp_file = os.path.join(wiki_page_dir(release), 'last.rev') + wp_file = os.path.join(wiki_page_dir(release), 'wiki.page') assert_equal(read_file(wp_file), 'wiki content')