def test_defaults_no_config_found(self): """ test the default values which are set when no config is present """ parser = helpers.setup_parser() config = helpers.setup_config( parser.parse_args(["--config", "fake.ini"])) assert config == dict(GENERAL=dict( channel=36, files_path="/var/www/html/profiler", interface="wlan0", ssid="WLAN Pi", ))
def test_config(self): parser = helpers.setup_parser() config = helpers.setup_config( parser.parse_args(["--config", "tests/config.ini"])) assert "GENERAL" in config.keys() for _ in ( "channel", "ssid", "interface", "ft_disabled", "he_disabled", "listen_only", "hostname_ssid", "files_path", ): assert _ in config["GENERAL"].keys()
def test_no_config_found(self): """ test the default values which are set when no config is present """ parser = helpers.setup_parser() config = helpers.setup_config( parser.parse_args([ "--config", "fake.ini", "-c", "1", "--files_path", "/nope/profiler", "-i", "wlan999", "-s", "Jerry Can You Hear Me", ])) assert config == dict(GENERAL=dict( channel=1, files_path="/nope/profiler", interface="wlan999", ssid="Jerry Can You Hear Me", ))
def parser(): return helpers.setup_parser()
def test_logger(self, args, expected): parser = helpers.setup_parser() helpers.setup_logger(parser.parse_args(args)) assert logging.root.level == expected