summaryrefslogtreecommitdiffstats
path: root/tests/test_gd_diff.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_gd_diff.py')
-rw-r--r--tests/test_gd_diff.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_gd_diff.py b/tests/test_gd_diff.py
index 67d9b8d..b62e014 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 builtins
import json
import os
import subprocess
@@ -350,6 +351,27 @@ class TestGdDiff(object):
assert_equal(configured, True)
+ def test_configure(self):
+ def env(e):
+ return self.test_home
+
+ inputs = ['usrnm', 'weasaspeciesrfckd']
+ def mock_input(p):
+ return inputs.pop(0)
+
+ with mock.patch('os.getenv', new=env), \
+ mock.patch('builtins.input', new=mock_input):
+ configure()
+
+ # read config file
+ config = json.load(open(config_file(), 'r'))
+
+ # tests
+ assert_equal(config['user'], 'usrnm')
+ assert_equal(config['pass'], 'weasaspeciesrfckd')
+ assert_equal(oct(os.stat(config_file()).st_mode), '0o100600')
+
+
def teardown(self):
"""Teardown method for this class."""
if(path.exists(self.gns_pkgs_dir)):