Unskip and fix handler tests in py3

This also removes from the blacklist tests passing.

Change-Id: Ic530fc9c60932cbd3742cc6026261734da7c4add
This commit is contained in:
Thomas Herve 2017-05-23 12:26:05 +02:00
parent 0c62a69eba
commit 9282ae8b0d
4 changed files with 9 additions and 12 deletions

View File

@ -379,7 +379,11 @@ class Service(service.RPCService, service.Service):
Check to make sure that the records in the recordset
follow the rules, and won't blow up on the nameserver.
"""
if hasattr(recordset, 'records'):
try:
recordset.records
except (AttributeError, exceptions.RelationNotLoaded):
pass
else:
if len(recordset.records) > 1 and recordset.type == 'CNAME':
raise exceptions.BadRequest(
'CNAME recordsets may not have more than 1 record'

View File

@ -113,7 +113,7 @@ class RequestHandler(xfr.XFRMixin):
question = request.question[0]
criterion = {
'name': question.name.to_text(),
'name': question.name.to_text().decode('utf-8'),
'type': 'SECONDARY',
'deleted': False
}
@ -349,7 +349,7 @@ class RequestHandler(xfr.XFRMixin):
# TODO(vinod) once validation is separated from the api,
# validate the parameters
criterion = {
'name': q_rrset.name.to_text(),
'name': q_rrset.name.to_text().decode('utf-8'),
'type': dns.rdatatype.to_text(q_rrset.rdtype),
'zones_deleted': False
}

View File

@ -429,7 +429,7 @@ class MdnsRequestHandlerTest(MdnsTestCase):
# ;AUTHORITY
# ;ADDITIONAL
expected_response = "d2f5850000010001000000010474657874076578616d706c6503636f6d0000100001c00c0010000100000e10000b0a666f6f747874646174610000292000000000000000" # noqa
expected_response = b"d2f5850000010001000000010474657874076578616d706c6503636f6d0000100001c00c0010000100000e10000b0a666f6f747874646174610000292000000000000000" # noqa
# This creates an TXT record for mail.example.com
zone = self.create_zone()
@ -445,7 +445,7 @@ class MdnsRequestHandlerTest(MdnsTestCase):
# query is for text.example.com. IN TXT
payload = "d2f5012000010000000000010474657874076578616d706c6503636f6d00001000010000291000000000000000" # noqa
expected_response = "d2f5850000010001000000010474657874076578616d706c6503636f6d0000100001c00c0010000100000e10000d03666f6f0362617204626c61680000292000000000000000" # noqa
expected_response = b"d2f5850000010001000000010474657874076578616d706c6503636f6d0000100001c00c0010000100000e10000d03666f6f0362617204626c61680000292000000000000000" # noqa
# expected_response is NOERROR. The other fields are
# response: id 54005
# opcode QUERY

View File

@ -1,15 +1,8 @@
# Blacklist of tests failing on Python 3
designate.tests.test_api.test_v1.test_records
designate.tests.test_api.test_v2.test_floatingips
designate.tests.test_api.test_v2.test_recordsets
designate.tests.test_api.test_v2.test_zones
designate.tests.test_central.test_service
designate.tests.test_dnsutils
designate.tests.test_mdns.test_handler
designate.tests.test_notification_handler.test_neutron
designate.tests.test_notification_handler.test_nova
designate.tests.test_pool_manager.test_service
designate.tests.test_storage.test_sqlalchemy
designate.tests.unit.test_central.test_basic
designate.tests.unit.test_pool
designate.tests.unit.test_producer.test_tasks