mirror of
https://github.com/coursera-dl/coursera-dl.git
synced 2026-01-24 03:05:38 +00:00
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
23 lines
707 B
Python
Vendored
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)
|