def test_parse_options_all_no_file(): """ Test the parse options process works with two options """ # GIVEN: a a set of system arguments. sys.argv[1:] = ['-l debug', '-p'] # WHEN: We we parse them to expand to options args = parse_options() # THEN: the following fields will have been extracted. assert args.loglevel == ' debug', 'The log level should be set to debug' assert args.no_error_form is False, 'The no_error_form should be set to False' assert args.portable is True, 'The portable flag should be set to false' assert args.rargs == [], 'The service file should be blank'
def test_parse_options_portable_and_portable_path(): """ Test the parse options process works portable and portable-path """ # GIVEN: a a set of system arguments. if is_win(): data_path = 'c:\\temp\\openlp-data' else: data_path = '/tmp/openlp-data' sys.argv[1:] = ['--portable', '--portable-path', '{datapath}'.format(datapath=data_path)] # WHEN: We we parse them to expand to options args = parse_options() # THEN: the following fields will have been extracted. assert args.loglevel == 'warning', 'The log level should be set to warning' assert args.no_error_form is False, 'The no_error_form should be set to False' assert args.portable is True, 'The portable flag should be set to true' assert args.portablepath == data_path, 'The portable path should be set as expected' assert args.rargs == [], 'The service file should be blank'