Deprecated -l flag, converted URL to positional argument

This commit is contained in:
Michael Lazar
2017-08-30 22:04:48 -04:00
parent 41333da82e
commit 91b35fe7fd
3 changed files with 34 additions and 10 deletions

View File

@@ -80,8 +80,8 @@ def test_config_get_args():
"Ensure that command line arguments are parsed properly"
args = ['rtv',
'https://reddit.com/permalink •',
'-s', 'cfb',
'-l', 'https://reddit.com/permalink •',
'--log', 'logfile.log',
'--config', 'configfile.cfg',
'--ascii',
@@ -113,6 +113,23 @@ def test_config_get_args():
assert config['enable_media'] is True
def test_config_link_deprecated():
# Should still be able to specify the link using the old "-l"
args = ['rtv', '-l', 'https://reddit.com/option']
with mock.patch('sys.argv', args):
config_dict = Config.get_args()
config = Config(**config_dict)
assert config['link'] == 'https://reddit.com/option'
# But the positional argument should take preference
args = ['rtv', 'https://reddit.com/arg', '-l', 'https://reddit.com/option']
with mock.patch('sys.argv', args):
config_dict = Config.get_args()
config = Config(**config_dict)
assert config['link'] == 'https://reddit.com/arg'
def test_config_from_file():
"Ensure that config file arguments are parsed properly"