From df84e1d7ebc9473aebc5dc3cfd1cf75243367162 Mon Sep 17 00:00:00 2001 From: Joshua Pan Date: Mon, 14 May 2018 13:17:03 -0400 Subject: [PATCH] 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. --- tools/test-backend | 1 - zerver/lib/management.py | 24 ++++++++---------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/tools/test-backend b/tools/test-backend index 8fc736c369..248f7322f9 100755 --- a/tools/test-backend +++ b/tools/test-backend @@ -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', diff --git a/zerver/lib/management.py b/zerver/lib/management.py index 707fc73c29..bc2d4e6978 100644 --- a/zerver/lib/management.py +++ b/zerver/lib/management.py @@ -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"]