Merge "Fix response POST /v2/meters/(meter_name) to 201 status"
This commit is contained in:
commit
bc571e31a2
@ -291,7 +291,7 @@ class MeterController(rest.RestController):
|
||||
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):
|
||||
"""Post a list of new Samples to Telemetry.
|
||||
|
||||
|
@ -248,7 +248,7 @@ class TestPostSamples(v2.FunctionalTest,
|
||||
data = self.post_json('/meters/my_counter_name/', s1,
|
||||
headers={"X-Roles": "admin"})
|
||||
|
||||
self.assertEqual(200, data.status_int)
|
||||
self.assertEqual(201, data.status_int)
|
||||
for x, s in enumerate(s1):
|
||||
# source is modified to include the project_id.
|
||||
s['source'] = '%s:%s' % (s['project_id'],
|
||||
@ -296,7 +296,7 @@ class TestPostSamples(v2.FunctionalTest,
|
||||
'name2': 'value2'}}]
|
||||
data = self.post_json('/meters/my_counter_name/', s1,
|
||||
expect_errors=True)
|
||||
self.assertEqual(200, data.status_int)
|
||||
self.assertEqual(201, data.status_int)
|
||||
for x, s in enumerate(s1):
|
||||
# source is modified to include the project_id.
|
||||
s['source'] = '%s:%s' % (
|
||||
@ -332,7 +332,7 @@ class TestPostSamples(v2.FunctionalTest,
|
||||
'X-User-Id': user_id,
|
||||
})
|
||||
|
||||
self.assertEqual(200, data.status_int)
|
||||
self.assertEqual(201, data.status_int)
|
||||
for x, s in enumerate(s1):
|
||||
# source is modified to include the project_id.
|
||||
s['source'] = '%s:%s' % (project_id,
|
||||
|
@ -31,7 +31,7 @@ tests:
|
||||
|
||||
response_json_paths:
|
||||
$.[0].counter_name: apples
|
||||
status: 200
|
||||
status: 201
|
||||
response_headers:
|
||||
content-type: application/json; charset=UTF-8
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user