1
0

Fixes previously introduced bug

The passed in command line options were saved to the user config.
This commit is contained in:
Chris Glass
2014-06-26 13:22:02 +02:00
parent 7338ac3c54
commit 99a31b0c6a
2 changed files with 25 additions and 9 deletions

View File

@@ -1,3 +1,4 @@
import ast
import sys
import os
import unittest
@@ -135,6 +136,23 @@ class Test_SimpleConfig(unittest.TestCase):
config.set_key("electrum_path", another_path)
self.assertEqual(another_path, config.get("electrum_path"))
def test_user_config_is_not_written_with_system_config(self):
"""The user config does not contain command-line options when saved."""
fake_read_system = lambda : {"something": "b"}
fake_read_user = lambda _: {"something": "a"}
read_user_dir = lambda : self.user_dir
self.options.update({"something": "c"})
config = SimpleConfig(options=self.options,
read_system_config_function=fake_read_system,
read_user_config_function=fake_read_user,
read_user_dir_function=read_user_dir)
config.save_user_config()
contents = None
with open(os.path.join(self.electrum_dir, "config"), "r") as f:
contents = f.read()
result = ast.literal_eval(contents)
self.assertEqual({"something": "a"}, result)
class TestSystemConfig(unittest.TestCase):