Пример #1
0
 def test_simple_config_user_config_is_used_if_others_arent_specified(self):
     """If no system-wide configuration and no command-line options are
     specified, the user configuration is used instead."""
     fake_read_system = lambda: {}
     fake_read_user = lambda _: {"electrum_path": self.electrum_dir}
     read_user_dir = lambda: self.user_dir
     config = SimpleConfig(options=None,
                           read_system_config_function=fake_read_system,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     self.assertEqual(self.options.get("electrum_path"),
                      config.get_above_chain("electrum_path"))
Пример #2
0
 def test_simple_config_user_config_is_used_if_others_arent_specified(self):
     """If no system-wide configuration and no command-line options are
     specified, the user configuration is used instead."""
     fake_read_system = lambda : {}
     fake_read_user = lambda _: {"electrum_path": self.electrum_dir}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options=None,
                           read_system_config_function=fake_read_system,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     self.assertEqual(self.options.get("electrum_path"),
                      config.get_above_chain("electrum_path"))
Пример #3
0
 def test_simple_config_system_config_ignored_if_portable(self):
     """If electrum is started with the "portable" flag, system
     configuration is completely ignored."""
     another_path = tempfile.mkdtemp()
     fake_read_system = lambda: {"electrum_path": self.electrum_dir}
     fake_read_user = lambda _: {"electrum_path": another_path}
     read_user_dir = lambda: self.user_dir
     config = SimpleConfig(options={"portable": True},
                           read_system_config_function=fake_read_system,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     self.assertEqual(another_path, config.get_above_chain("electrum_path"))
Пример #4
0
 def test_simple_config_system_config_ignored_if_portable(self):
     """If electrum is started with the "portable" flag, system
     configuration is completely ignored."""
     another_path = tempfile.mkdtemp()
     fake_read_system = lambda : {"electrum_path": self.electrum_dir}
     fake_read_user = lambda _: {"electrum_path": another_path}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options={"portable": True},
                           read_system_config_function=fake_read_system,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     self.assertEqual(another_path, config.get_above_chain("electrum_path"))