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 61a47f6da59efc6369edb6c8562f663bc4c0333d
parent da1c3d97e01882c90f276173df54b4bdfbc58452
Author: rsiddharth <s@ricketyspace.net>
Date:   Sun, 13 Nov 2016 00:54:10 +0000

Add `configured_p` function.

* gd_diff.py (configured_p): New function.
* tests/test_gd_diff.py (test_configured_p_no)
(test_configured_p_yes): Test functions for `configured_p`.

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

diff --git a/gd_diff.py b/gd_diff.py @@ -217,3 +217,12 @@ def config_dir(): def config_file(): return os.path.join(config_dir(), 'config') + + +def configured_p(): + """Returns True if gns-deb-diff is configured; False otherwise. + """ + if os.path.isfile(config_file()): + return True + else: + return False diff --git a/tests/test_gd_diff.py b/tests/test_gd_diff.py @@ -246,6 +246,30 @@ class TestGdDiff(object): 'gns-deb-diff', 'config')) + def test_configured_p_no(self): + def env(e): + return self.test_home + + with mock.patch('os.getenv', new=env): + configured = configured_p() + assert_equal(configured, False) + + + def test_configured_p_yes(self): + def env(e): + return self.test_home + + with mock.patch('os.getenv', new=env): + c_path = config_dir() + c_file = config_file() + + os.makedirs(c_path) + open(c_file, 'w').close() + + configured = configured_p() + assert_equal(configured, True) + + def teardown(self): """Teardown method for this class.""" if(path.exists(self.gns_pkgs_dir)):