Skip to content

Commit fb5703a

Browse files
committed
Added validation to close_project.
1 parent 06f405d commit fb5703a

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

dynatademand/api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ def create_project(self, project_data):
190190
def close_project(self, project_id):
191191
# Closes the requested project. Once a project is closed, all traffic
192192
# is stopped, and the project is automatically sent for invoicing.
193+
self.validator.validate_request(
194+
'close_project',
195+
path_data={'extProjectId': '{}'.format(project_id)},
196+
)
193197
response_data = self._api_post('/projects/{}/close'.format(project_id), {})
194198
if response_data.get('status').get('message') != 'success':
195199
raise DemandAPIError(
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"extProjectId": {
5+
"type": "string",
6+
"required": true
7+
}
8+
},
9+
"required": [
10+
"extProjectId"
11+
]
12+
}

dynatademand/validator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
'create_project': ['body', ],
1212
'get_projects': ['query', ],
1313
'get_project': ['path', ],
14+
'close_project': ['path', ],
1415
'update_project': ['path', 'body', ],
1516
'get_project_detailed_report': ['path', ],
1617

0 commit comments

Comments
 (0)