Merge "Fix response POST /v2/meters/(meter_name) to 201 status"

This commit is contained in:
Jenkins 2015-03-11 15:53:06 +00:00 committed by Gerrit Code Review
commit bc571e31a2
3 changed files with 5 additions and 5 deletions

View File

@ -291,7 +291,7 @@ class MeterController(rest.RestController):
for e in pecan.request.storage_conn.get_samples(f, limit=limit) for e in pecan.request.storage_conn.get_samples(f, limit=limit)
] ]
@wsme_pecan.wsexpose([OldSample], body=[OldSample]) @wsme_pecan.wsexpose([OldSample], body=[OldSample], status_code=201)
def post(self, samples): def post(self, samples):
"""Post a list of new Samples to Telemetry. """Post a list of new Samples to Telemetry.

View File

@ -248,7 +248,7 @@ class TestPostSamples(v2.FunctionalTest,
data = self.post_json('/meters/my_counter_name/', s1, data = self.post_json('/meters/my_counter_name/', s1,
headers={"X-Roles": "admin"}) headers={"X-Roles": "admin"})
self.assertEqual(200, data.status_int) self.assertEqual(201, data.status_int)
for x, s in enumerate(s1): for x, s in enumerate(s1):
# source is modified to include the project_id. # source is modified to include the project_id.
s['source'] = '%s:%s' % (s['project_id'], s['source'] = '%s:%s' % (s['project_id'],
@ -296,7 +296,7 @@ class TestPostSamples(v2.FunctionalTest,
'name2': 'value2'}}] 'name2': 'value2'}}]
data = self.post_json('/meters/my_counter_name/', s1, data = self.post_json('/meters/my_counter_name/', s1,
expect_errors=True) expect_errors=True)
self.assertEqual(200, data.status_int) self.assertEqual(201, data.status_int)
for x, s in enumerate(s1): for x, s in enumerate(s1):
# source is modified to include the project_id. # source is modified to include the project_id.
s['source'] = '%s:%s' % ( s['source'] = '%s:%s' % (
@ -332,7 +332,7 @@ class TestPostSamples(v2.FunctionalTest,
'X-User-Id': user_id, 'X-User-Id': user_id,
}) })
self.assertEqual(200, data.status_int) self.assertEqual(201, data.status_int)
for x, s in enumerate(s1): for x, s in enumerate(s1):
# source is modified to include the project_id. # source is modified to include the project_id.
s['source'] = '%s:%s' % (project_id, s['source'] = '%s:%s' % (project_id,

View File

@ -31,7 +31,7 @@ tests:
response_json_paths: response_json_paths:
$.[0].counter_name: apples $.[0].counter_name: apples
status: 200 status: 201
response_headers: response_headers:
content-type: application/json; charset=UTF-8 content-type: application/json; charset=UTF-8