Fix tempest test for empty_body

Depending on the actual server in which monasca-log-api
is running, the error code for empty body may differ.

For example, for mod_wsgi the error code is 411,
but, on the other hand, gunicorn (devstack's setup)
returns 422. Since the actual error code is not that important,
simply accept all of them.

Change-Id: I6ab160148863f38b08172eee430ebce4c3e9e04d
This commit is contained in:
wachowskij 2017-06-28 12:16:05 +02:00
parent 0c9734a898
commit 8395231400
1 changed files with 4 additions and 2 deletions

View File

@ -26,10 +26,12 @@ class TestLogApiConstraints(base.BaseLogsTestCase):
try:
cli.custom_request('POST', headers, None)
except exceptions.UnprocessableEntity as urc:
self.assertEqual(422, urc.resp.status)
# depending on the actual server (for example gunicorn vs mod_wsgi)
# monasca-log-api may return a different error code
self.assertTrue(urc.resp.status in [411, 422])
return
self.assertTrue(False, 'API should respond with 411')
self.assertTrue(False, 'API should respond with an error')
@decorators.attr(type='gate')
def test_should_reject_if_content_type_missing(self):