Add project model in testapiclient 77/56877/5
authorthuva4 <tharma.thuva@gmail.com>
Sun, 29 Apr 2018 12:10:00 +0000 (17:40 +0530)
committerthuva4 <tharma.thuva@gmail.com>
Mon, 7 May 2018 05:38:10 +0000 (11:08 +0530)
Change-Id: If238e2d22f3c895264c90579c7c4d0b442f6c82a
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
testapi/testapi-client/testapiclient/cli/projects.py
testapi/testapi-client/testapiclient/models/project.py [new file with mode: 0644]

index 510acc8..2fa5b5b 100644 (file)
@@ -2,6 +2,7 @@ import json
 
 from testapiclient.utils import command
 from testapiclient.utils import urlparse
+from testapiclient.models import project
 
 
 def projects_url():
@@ -51,9 +52,10 @@ class ProjectCreate(command.ShowOne):
         parser = super(ProjectCreate, self).get_parser(prog_name)
         parser.add_argument('project',
                             type=json.loads,
-                            help='Project create request format :{'
-                                 ' "name": (required)"", '
-                                 '"description": (optional)""}')
+                            help='Project create request format :\n'
+                                 '\'{}\''.format(json.dumps(
+                                     project.ProjectCreateRequest().__dict__
+                                     )))
         return parser
 
     def take_action(self, parsed_args):
@@ -83,9 +85,10 @@ class ProjectPut(command.ShowOne):
                             help='Update project by name')
         parser.add_argument('project',
                             type=json.loads,
-                            help='Project Update request format :{'
-                                 '"name": (required)"", '
-                                 '"description": (optional)""}')
+                            help='Project Update request format :\n'
+                                 '\'{}\''.format(json.dumps(
+                                     project.ProjectCreateRequest().__dict__
+                                     )))
         return parser
 
     def take_action(self, parsed_args):
diff --git a/testapi/testapi-client/testapiclient/models/project.py b/testapi/testapi-client/testapiclient/models/project.py
new file mode 100644 (file)
index 0000000..fc85588
--- /dev/null
@@ -0,0 +1,4 @@
+class ProjectCreateRequest():
+    def __init__(self, name='', description=''):
+        self.description = description
+        self.name = name