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 92b8a39ca5d48dad73c646439529e9f84a76fc78
parent 2bc1c934c0e2c00757f5cce09074d5fcca3a64d0
Author: rsiddharth <s@ricketyspace.net>
Date:   Sun, 13 Nov 2016 03:21:53 +0000

Add `write_wiki_page` function.

* gd_diff.py (write_wiki_page): New function.
* tests/test_gd_diff.py (test_write_wiki_page): Test for
  `write_wiki_page`.

Diffstat:
gd_diff.py | 9+++++++++
tests/test_gd_diff.py | 11+++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/gd_diff.py b/gd_diff.py @@ -283,6 +283,15 @@ def wiki_page_dir(release): return wd_release +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') + write_file(wp_file, content) + + def configured_p(): """Returns True if gns-deb-diff is configured; False otherwise. """ diff --git a/tests/test_gd_diff.py b/tests/test_gd_diff.py @@ -293,6 +293,17 @@ class TestGdDiff(object): assert_equal(os.path.isdir(wd_parkes), True) + def test_write_wiki_page(self): + def env(e): + return self.test_home + + with mock.patch('os.getenv', new=env): + release = 'parkes' + write_wiki_page(release, 'wiki content') + wp_file = os.path.join(wiki_page_dir(release), 'last.rev') + assert_equal(read_file(wp_file), 'wiki content') + + def test_configured_p_no(self): def env(e): return self.test_home