Repository: Duke-GCB/DukeDSClient

Issue:
Remove duplicate commands in commandline.
There shouldn't be both add-user and add_user in the help.

Discussion:

Patch:
diff --git a/ddsc/cmdparser.py b/ddsc/cmdparser.py
index 4f381b6..4d6e9c0 100644
--- a/ddsc/cmdparser.py
+++ b/ddsc/cmdparser.py
@@ -271,7 +271,6 @@ class CommandParser(object):
         """
         description = "Gives user permission to access a remote project."
         add_user_parser = self.subparsers.add_parser('add-user', description=description)
-        self.subparsers.choices['add_user'] = add_user_parser
         add_project_name_arg(add_user_parser, help_text="Name of the project to add a user to.")
         user_or_email = add_user_parser.add_mutually_exclusive_group(required=True)
         add_user_arg(user_or_email)
@@ -286,7 +285,6 @@ class CommandParser(object):
         """
         description = "Removes user permission to access a remote project."
         remove_user_parser = self.subparsers.add_parser('remove-user', description=description)
-        self.subparsers.choices['remove_user'] = remove_user_parser
         add_project_name_arg(remove_user_parser, help_text="Name of the project to remove a user from.")
         user_or_email = remove_user_parser.add_mutually_exclusive_group(required=True)
         add_user_arg(user_or_email)


Test patch:
diff --git a/ddsc/tests/test_cmdparser.py b/ddsc/tests/test_cmdparser.py
new file mode 100644
index 0000000..d1c4df7
--- /dev/null
+++ b/ddsc/tests/test_cmdparser.py
@@ -0,0 +1,19 @@
+from __future__ import absolute_import
+from unittest import TestCase
+from ddsc.cmdparser import CommandParser
+
+
+def no_op():
+    pass
+
+
+class TestCommandParser(TestCase):
+    def test_register_add_user_command(self):
+        command_parser = CommandParser()
+        command_parser.register_add_user_command(no_op)
+        self.assertEqual(['add-user'], list(command_parser.subparsers.choices.keys()))
+
+    def test_register_remove_user_command(self):
+        command_parser = CommandParser()
+        command_parser.register_remove_user_command(no_op)
+        self.assertEqual(['remove-user'], list(command_parser.subparsers.choices.keys()))