Adds PATCH /v2/plans/:plan_uuid endpoint
This patch adds hollow PATCH /v2/plans/:plan_uuid endpoint which returns only dummy response. Logic to manipulate real data will be added later. Change-Id: Ia6b14ccc0834f833560dab2d2b188ea90dea1807 Implements: blueprint tripleo-juno-tuskar-plan-rest-api
This commit is contained in:
parent
f742151764
commit
497b6522ee
@ -114,3 +114,23 @@ class PlansController(rest.RestController):
|
||||
@pecan.expose()
|
||||
def templates(self, plan_uuid):
|
||||
return plan_uuid
|
||||
|
||||
@wsme.validate(models.Plan)
|
||||
@wsme_pecan.wsexpose(models.Plan,
|
||||
str,
|
||||
body=models.Plan,
|
||||
status_code=201)
|
||||
def patch(self, plan_uuid, transfer_plan):
|
||||
"""Patches existing plan.
|
||||
|
||||
:param transfer_plan: data submitted by the user
|
||||
:type transfer_plan:
|
||||
tuskar.api.controllers.v1.models.Plan
|
||||
|
||||
:return: patched plan
|
||||
:rtype: tuskar.api.controllers.v1.models.Plan
|
||||
"""
|
||||
LOG.debug('Patching plan: %s' % transfer_plan)
|
||||
|
||||
# Package for transfer back to the user
|
||||
return transfer_plan
|
||||
|
@ -86,3 +86,16 @@ class PlansTests(base.TestCase):
|
||||
# Verify
|
||||
self.assertEqual(response.status_int, 200)
|
||||
self.assertEqual(result, 'foo')
|
||||
|
||||
def test_patch(self):
|
||||
# Setup
|
||||
plan_data = {'name': 'new'}
|
||||
|
||||
# Test
|
||||
url = URL_PLANS + '/' + 'qwert12345'
|
||||
response = self.app.patch_json(url, plan_data)
|
||||
result = response.json
|
||||
|
||||
# Verify
|
||||
self.assertEqual(response.status_int, 201)
|
||||
self.assertEqual(result['name'], plan_data['name'])
|
||||
|
Loading…
Reference in New Issue
Block a user