coursera-dl/coursera/test/test_commandline.py
Anderson Mesquita d3d1c4d0f1 Make class_names arg optional for certain flags
The `class_names` argument shouldn't be required for certain flags (e.g.
`--version` or `--list-courses`).  This makes it optional while also
taking these flags into account to display an appropriate error message
when they aren't being used.

Fixes #562
2016-08-06 10:09:38 -07:00

23 lines
707 B
Python
Vendored

"""
Test command line module.
"""
from coursera import commandline
from coursera.test import test_workflow
def test_class_name_arg_required():
args = {'list_courses': False, 'version': False}
mock_args = test_workflow.MockedCommandLineArgs(**args)
assert commandline.class_name_arg_required(mock_args)
def test_class_name_arg_not_required():
not_required_cases = [
{'list_courses': True, 'version': False},
{'list_courses': False, 'version': True},
{'list_courses': True, 'version': True},
]
for args in not_required_cases:
mock_args = test_workflow.MockedCommandLineArgs(**args)
assert not commandline.class_name_arg_required(mock_args)