summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gd_diff.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_gd_diff.py b/tests/test_gd_diff.py
index cc7fc4a..67d9b8d 100644
--- a/tests/test_gd_diff.py
+++ b/tests/test_gd_diff.py
@@ -6,6 +6,7 @@
# gns-deb-diff is under the Public Domain. See
# <https://creativecommons.org/publicdomain/zero/1.0>
+import json
import os
import subprocess
import sys
@@ -247,6 +248,28 @@ class TestGdDiff(object):
'gns-deb-diff', 'config'))
+ def test_read_config_file_fail(self):
+ config = read_config_file()
+ assert_equal(config, False)
+
+
+ def test_read_config_file_success(self):
+ def env(e):
+ return self.test_home
+
+ with mock.patch('os.getenv', new=env):
+ c_file = config_file()
+
+ # first write sample config file.
+ json.dump({'user': 'usrnm', 'pass': 'weasaspeciesrfckd'},
+ open(c_file, 'w'))
+
+ # now on to the test.
+ config = read_config_file()
+ assert_equal(config['user'], 'usrnm')
+ assert_equal(config['pass'], 'weasaspeciesrfckd')
+
+
def test_pkgs_dir(self):
def env(e):
return self.test_home