def test_loglevel_arg(self): os.environ.clear() cfg = get_configuration( args=["--config=invalid-config.js", "--loglevel=info"], config_files_required=False) self.assertIn("LogLevel", cfg) self.assertEquals(cfg["LogLevel"], "INFO")
def test_logconfig_arg(self): os.environ.clear() cfg = get_configuration( args=["--config=invalid-config.js", "--log-config=Logging.js"], config_files_required=False) self.assertIn("LogConfigFile", cfg) self.assertEquals(cfg["LogConfigFile"], "Logging.js")
def test_default_config_posix(self): os.environ.clear() cfg = get_configuration(args=["--config=invalid-config.js"], os_name='posix', config_files_required=False) self.assertNotIn("CurrencyHome", cfg) self.assertEquals(cfg["ConfigDirectory"], "/etc/sawtooth-validator") self.assertEquals(cfg["LogDirectory"], "/var/log/sawtooth-validator") self.assertEquals(cfg["DataDirectory"], "/var/lib/sawtooth-validator")
def test_currency_home(self): os.environ.clear() os.environ["CURRENCYHOME"] = "/test_path" cfg = get_configuration(args=[], config_files_required=False) self.assertIn("CurrencyHome", cfg) self.assertEquals(cfg["CurrencyHome"], "/test_path") self.assertEquals(cfg["ConfigDirectory"], "/test_path/etc") self.assertEquals(cfg["LogDirectory"], "/test_path/logs") self.assertEquals(cfg["DataDirectory"], "/test_path/data")
def test_default_config_nt(self): os.environ.clear() cfg = get_configuration(args=["--config=invalid-config.js"], os_name='nt', config_files_required=False) self.assertNotIn("CurrencyHome", cfg) self.assertEquals( cfg["ConfigDirectory"], "C:\\Program Files (x86)\\Intel\\sawtooth-validator\\conf") self.assertEquals( cfg["LogDirectory"], "C:\\Program Files (x86)\\Intel\\sawtooth-validator\\logs") self.assertEquals( cfg["DataDirectory"], "C:\\Program Files (x86)\\Intel\\sawtooth-validator\\data")