Last active
August 29, 2015 14:10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zaqarclient/transport/errors.py | |
class InvalidContentType(TransportError): | |
"""Indicates that the server has not | |
send response in JSON form. | |
This error maps to HTTP's 504 | |
""" | |
pass | |
# zaqarclient/transport/response.py | |
@property | |
def deserialized_content(self): | |
#if self.content['content-type'] == 'application/json': | |
#if self.headers['status_code'] == 504: | |
#if self.headers['Content-Type'] == 'application/json': | |
try: | |
if self.headers.get('content-type') != 'application/json': | |
raise errors.InvalidContentType() | |
if not self._deserialized and self.content: | |
self._deserialized = json.loads(self.content) | |
return self._deserialized | |
except Exception: | |
print('Response is not JSON object.') | |
return None | |
# when run `tox -e py27` got errors: | |
QueuesV1QueueHttpFunctionalTest | |
test_message_delete_many_functional SKIP | |
test_message_get_functional SKIP | |
test_message_get_many_functional SKIP | |
test_message_list_echo_functional SKIP | |
test_message_list_functional SKIP | |
test_message_post_functional SKIP | |
test_queue_create_functional SKIP | |
test_queue_delete_functional SKIP | |
test_queue_exists_functional SKIP | |
test_queue_metadata_functional SKIP | |
test_queue_metadata_reload_functional SKIP | |
test_queue_stats_functional SKIP | |
TestBaseAuth | |
test_get_backend OK 0.00 | |
test_get_non_existing_backend OK 0.00 | |
TestKeystoneAuth | |
test_no_token OK 0.00 | |
test_with_token OK 0.00 | |
TestCommonHttp | |
test_data_serialization OK 0.02 | |
QueuesV1ClaimsHttpUnitTest | |
test_claim FAIL 0.00 | |
test_claim_delete OK 0.00 | |
test_claim_get_by_id ERROR 0.00 | |
test_claim_update OK 0.00 | |
QueuesV1_1ClaimsHttpUnitTest | |
test_claim FAIL 0.01 | |
test_claim_delete OK 0.00 | |
test_claim_get_by_id ERROR 0.00 | |
test_claim_update OK 0.00 | |
TestClient | |
test_health_1_1 OK 0.00 | |
test_health_2_1_1 OK 0.00 | |
test_transport_1_1 OK 0.00 | |
test_transport_2_1_1 OK 0.00 | |
TestV1Core | |
test_get_queue_metadata OK 0.00 | |
test_health OK 0.00 | |
test_message_delete OK 0.00 | |
test_message_delete_many OK 0.00 | |
test_message_get OK 0.00 | |
test_message_get_many OK 0.00 | |
test_message_list OK 0.00 | |
test_message_list_kwargs OK 0.00 | |
test_message_post_many OK 0.00 | |
test_message_post_one OK 0.00 | |
test_pool_create OK 0.00 | |
test_pool_delete OK 0.00 | |
test_queue_create OK 0.00 | |
test_queue_delete OK 0.00 | |
test_queue_exists OK 0.00 | |
test_queue_exists_not_found OK 0.00 | |
test_queue_get_stats FAIL 0.00 | |
test_set_queue_metadata OK 0.00 | |
TestV1_1Core | |
test_get_queue_metadata OK 0.00 | |
test_health OK 0.00 | |
test_message_delete OK 0.00 | |
test_message_delete_many OK 0.00 | |
test_message_get OK 0.00 | |
test_message_get_many OK 0.00 | |
test_message_list OK 0.00 | |
test_message_list_kwargs OK 0.00 | |
test_message_pop OK 0.00 | |
test_message_post_many OK 0.00 | |
test_message_post_one OK 0.00 | |
test_pool_create OK 0.00 | |
test_pool_delete OK 0.00 | |
test_queue_create OK 0.00 | |
test_queue_delete OK 0.00 | |
test_queue_exists OK 0.00 | |
test_queue_exists_not_found OK 0.00 | |
test_queue_get_stats FAIL 0.00 | |
test_set_queue_metadata OK 0.00 | |
QueuesV1_1FlavorHttpUnitTest | |
test_flavor_create OK 0.00 | |
test_flavor_delete OK 0.00 | |
QueuesV1MessageHttpUnitTest | |
test_message_delete ERROR 0.00 | |
test_message_delete_with_claim ERROR 0.00 | |
QueuesV1_1MessageHttpUnitTest | |
test_message_delete ERROR 0.00 | |
test_message_delete_with_claim ERROR 0.01 | |
TestMessageIterator | |
test_iterator_respect_paging OK 0.00 | |
test_no_next_iteration OK 0.00 | |
test_stream FAIL 0.00 | |
QueuesV1PoolHttpUnitTest | |
test_pool_create OK 0.00 | |
test_pool_delete OK 0.00 | |
QueuesV1QueueHttpUnitTest | |
test_message_delete_many OK 0.00 | |
test_message_get ERROR 0.00 | |
test_message_get_many OK 0.00 | |
test_message_list OK 0.00 | |
test_message_post FAIL 0.00 | |
test_queue_create OK 0.00 | |
test_queue_delete OK 0.00 | |
test_queue_exists OK 0.01 | |
test_queue_metadata OK 0.00 | |
test_queue_metadata_update OK 0.00 | |
test_queue_stats FAIL 0.00 | |
QueuesV1_1QueueHttpUnitTest | |
test_message_delete_many OK 0.00 | |
test_message_get ERROR 0.00 | |
test_message_get_many OK 0.00 | |
test_message_list OK 0.00 | |
test_message_pop OK 0.00 | |
test_message_post FAIL 0.00 | |
test_queue_create OK 0.01 | |
test_queue_delete OK 0.00 | |
test_queue_exists OK 0.00 | |
test_queue_metadata OK 0.01 | |
test_queue_metadata_update OK 0.00 | |
test_queue_stats FAIL 0.01 | |
TestClient | |
test_get_instance OK 0.00 | |
test_version_failure OK 0.00 | |
TestApi | |
test_invalid_operation OK 0.00 | |
test_invalid_params OK 0.00 | |
test_missing_params OK 0.00 | |
test_valid_params OK 0.00 | |
TestHttpTransport | |
test_basic_send OK 0.00 | |
test_error_handling OK 0.01 | |
test_send_without_api OK 0.00 | |
TestRequest | |
test_prepare_request OK 0.00 | |
test_prepare_request_with_data OK 0.00 | |
test_request_project_id OK 0.00 | |
====================================================================== | |
ERROR: tests.unit.queues.v1.test_claims.QueuesV1ClaimsHttpUnitTest.test_claim_get_by_id | |
---------------------------------------------------------------------- | |
_StringException: Empty attachments: | |
pythonlogging:'zaqar' | |
stderr | |
Traceback (most recent call last): | |
File "/opt/stack/python-zaqarclient/zaqarclient/tests/queues/claims.py", line 75, in test_claim_get_by_id | |
for num, msg in enumerate(cl): | |
File "/opt/stack/python-zaqarclient/zaqarclient/queues/v1/claim.py", line 74, in __iter__ | |
self._get() | |
File "/opt/stack/python-zaqarclient/zaqarclient/queues/v1/claim.py", line 44, in _get | |
self._age = claim_res['age'] | |
TypeError: 'NoneType' object has no attribute '__getitem__' | |
-------------------- >> begin captured stdout << --------------------- | |
Response is not JSON object. | |
--------------------- >> end captured stdout << ---------------------- | |
====================================================================== | |
FAIL: tests.unit.queues.v1.test_queues.QueuesV1_1QueueHttpUnitTest.test_queue_stats | |
---------------------------------------------------------------------- | |
_StringException: Empty attachments: | |
pythonlogging:'zaqar' | |
stderr | |
Traceback (most recent call last): | |
File "/opt/stack/python-zaqarclient/zaqarclient/tests/queues/queues.py", line 120, in test_queue_stats | |
self.assertEqual(result, stats) | |
File "/opt/stack/python-zaqarclient/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 348, in assertEqual | |
self.assertThat(observed, matcher, message) | |
File "/opt/stack/python-zaqarclient/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 433, in assertThat | |
raise mismatch_error | |
MismatchError: !=: | |
reference = {'messages': {'claimed': 2409, | |
'free': 146929, | |
'newest': {'age': 12, | |
'created': '2013-08-12T20:45:46Z', | |
'href': '/v1/queues/qq/messages/50b68a50d6f5b8c8a7c62b01'}, | |
'oldest': {'age': 63, | |
'created': '2013-08-12T20:44:55Z', | |
'href': '/v1/queues/qq/messages/50b68a50d6f5b8c8a7c62b01'}, | |
'total': 149338}} | |
actual = None | |
-------------------- >> begin captured stdout << --------------------- | |
Response is not JSON object. | |
--------------------- >> end captured stdout << ---------------------- | |
---------------------------------------------------------------------- | |
Ran 119 tests in 0.508s | |
FAILED (SKIP=19, errors=8, failures=9) | |
ERROR: InvocationError: '/opt/stack/python-zaqarclient/.tox/py27/bin/nosetests' | |
_______________________________________________________________ summary ________________________________________________________________ | |
ERROR: py27: commands failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment