tests: Reach 100% coverage for zerver/liv/management.py.

Cleaned up add_user_list_args(). The "help" and
"all_users_help" have all default values. As noted in
an earlier commit, "all_users_help" is always passed in,
so we can get rid of "all_users_arg". We keep the default
for "all_users_help" so we don't have to change variable order
in function definition.
This commit is contained in:
Joshua Pan 2018-05-14 13:17:03 -04:00 committed by Tim Abbott
parent ef098d2223
commit df84e1d7eb
2 changed files with 8 additions and 17 deletions

View File

@ -57,7 +57,6 @@ not_yet_fully_covered = {
'zerver/lib/create_user.py',
'zerver/lib/exceptions.py',
'zerver/lib/i18n.py',
'zerver/lib/management.py',
'zerver/lib/notifications.py',
'zerver/lib/send_email.py',
'zerver/lib/upload.py',

View File

@ -44,28 +44,20 @@ You can use the command list_realms to find ID of the realms in this server."""
help=help)
def add_user_list_args(self, parser: ArgumentParser,
help: Optional[str]=None,
all_users_arg: bool=True,
all_users_help: Optional[str]=None) -> None:
if help is None:
help = 'A comma-separated list of email addresses.'
help: str='A comma-separated list of email addresses.',
all_users_help: str="All users in realm.") -> None:
parser.add_argument(
'-u', '--users',
dest='users',
type=str,
help=help)
if all_users_arg:
if all_users_help is None:
all_users_help = "All users in realm."
parser.add_argument(
'-a', '--all-users',
dest='all_users',
action="store_true",
default=False,
help=all_users_help)
parser.add_argument(
'-a', '--all-users',
dest='all_users',
action="store_true",
default=False,
help=all_users_help)
def get_realm(self, options: Dict[str, Any]) -> Optional[Realm]:
val = options["realm_id"]