def test_07a_get_default_configuration(): """ Tests that default configuration is obtained. tests: R-CONF-CLI-007 """ c = CommandLine(["-l"]) c.parse_arguments() assert c.parser_configuration == dict(file_names=None) assert c.filter_configuration == dict(package_names=None, search_reg_exps=None, dates=None) assert c.filter_extra_configuration == dict(case_sensitive=False) assert c.processor_configuration == dict(name=processor.MERGE, query=False, active_filter=set()) assert c.output_configuration == dict(utc=False, color=True)
def test_07b_get_configurations(): """ Tests that the correct configuration is obtained for different arguments. tests: R-CONF-CLI-007 """ conf_test = [ (["-l", "pkg"], dict(file_names=None), dict(package_names=["pkg"], search_reg_exps=None, dates=None), dict(case_sensitive=False), dict(name=processor.MERGE, query=False, active_filter={"package_names", }), dict(utc=False, color=True)), (["-l", "pkg", "pkg2"], dict(file_names=None), dict(package_names=["pkg", "pkg2"], search_reg_exps=None, dates=None), dict(case_sensitive=False), dict(name=processor.MERGE, query=False, active_filter={"package_names", }), dict(utc=False, color=True)), (["-l", "-f", "file1", "-f", "file2"], dict(file_names=["file1", "file2"]), dict(package_names=None, search_reg_exps=None, dates=None), dict(case_sensitive=False), dict(name=processor.MERGE, query=False, active_filter=set()), dict(utc=False, color=True)), (["-l", "--date", "1", "--date", "1337"], dict(file_names=None), dict(package_names=None, search_reg_exps=None, dates=["1", "1337"]), dict(case_sensitive=False), dict(name=processor.MERGE, query=False, active_filter={"dates", }), dict(utc=False, color=True)), (["-l", "--search", ".*", "-s", "foo[a-z]+"], dict(file_names=None), dict(package_names=None, search_reg_exps=[".*", "foo[a-z]+"], dates=None), dict(case_sensitive=False), dict(name=processor.MERGE, query=False, active_filter={"search_reg_exps", }), dict(utc=False, color=True)), (["-l", "-g"], dict(file_names=None), dict(package_names=None, search_reg_exps=None, dates=None), dict(case_sensitive=False), dict(name=processor.MERGE, query=False, active_filter=set()), dict(utc=True, color=True)), (["-l", "-n"], dict(file_names=None), dict(package_names=None, search_reg_exps=None, dates=None), dict(case_sensitive=False), dict(name=processor.MERGE, query=False, active_filter=set()), dict(utc=False, color=False)), (["-l", "--gmt", "--nocolor"], dict(file_names=None), dict(package_names=None, search_reg_exps=None, dates=None), dict(case_sensitive=False), dict(name=processor.MERGE, query=False, active_filter=set()), dict(utc=True, color=False)), (["-t", "-q", "cat/pkg"], dict(file_names=None), dict(package_names=["cat/pkg"], search_reg_exps=None, dates=None), dict(case_sensitive=False), dict(name=processor.TIME, query=True, active_filter={"package_names", }), dict(utc=False, color=True)), (["-l", "-S"], dict(file_names=None), dict(package_names=None, search_reg_exps=None, dates=None), dict(case_sensitive=True), dict(name=processor.MERGE, query=False, active_filter=set()), dict(utc=False, color=True)), ] for args, \ expected_parser_configuration, \ expected_filter_configuration, \ expected_filter_extra_configuration, \ expected_processor_configuration, \ expected_output_configuration \ in conf_test: c = CommandLine(args) c.parse_arguments() assert c.parser_configuration == expected_parser_configuration assert c.filter_configuration == expected_filter_configuration assert c.filter_extra_configuration == expected_filter_extra_configuration assert c.processor_configuration == expected_processor_configuration assert c.output_configuration == expected_output_configuration