Commit 5164eb98 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

astakos: Do a PUT to modify project, not POST

Replace POST with PUT in the API call the modifies a project.
parent 43e10603
......@@ -861,7 +861,7 @@ class AstakosClient(object):
method="POST")
# ------------------------------------------
# do a POST to ``API_PROJECTS``/<project_id>
# do a PUT to ``API_PROJECTS``/<project_id>
def modify_project(self, project_id, specs):
"""Submit application to modify an existing project
......@@ -875,7 +875,7 @@ class AstakosClient(object):
req_headers = {'content-type': 'application/json'}
req_body = parse_request(specs, self.logger)
return self._call_astakos(path, headers=req_headers,
body=req_body, method="POST")
body=req_body, method="PUT")
# -------------------------------------------------
# do a POST to ``API_PROJECTS``/<project_id>/action
......
......@@ -379,9 +379,8 @@ the container level.
Changes in the projects API
```````````````````````````
``PUT /projects`` will be used to make a new project replacing ``POST``.
``POST /projects/<proj_id>`` now expects a dictionary with just the desired
``PUT /projects/<proj_id>`` will be used to mod a new project replacing
``POST``. It now expects a dictionary with just the desired
changes, not a complete project definition. It is only allowed if the
project is already activated.
......
......@@ -155,7 +155,7 @@ Status Description
Modify a Project
................
**POST** /account/v1.0/projects/<proj_id>
**PUT** /account/v1.0/projects/<proj_id>
==================== =========================
Request Header Name Value
......
......@@ -329,9 +329,9 @@ def project(request, project_id):
method = request.method
if method == "GET":
return get_project(request, project_id)
if method == "POST":
if method == "PUT":
return modify_project(request, project_id)
return api.api_method_not_allowed(request, allowed_methods=['GET', 'POST'])
return api.api_method_not_allowed(request, allowed_methods=['GET', 'PUT'])
@api.api_method(http_method="GET", token_required=True, user_required=False)
......@@ -352,7 +352,7 @@ def _get_project(project_id, request_user=None):
return project
@api.api_method(http_method="POST", token_required=True, user_required=False)
@api.api_method(http_method="PUT", token_required=True, user_required=False)
@user_from_token
@transaction.commit_on_success
def modify_project(request, project_id):
......
......@@ -98,7 +98,7 @@ class ProjectAPITest(TestCase):
def modify(self, app, project_id, headers):
dump = json.dumps(app)
kwargs = {"project_id": project_id}
r = self.client.post(reverse("api_project", kwargs=kwargs), dump,
r = self.client.put(reverse("api_project", kwargs=kwargs), dump,
content_type="application/json", **headers)
body = json.loads(r.content)
return r.status_code, body
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment