Fix broken UTs due to py3

Changes str to bytes to fix some UTs.

Partially-Implements: blueprint designate-py3

Change-Id: Icb7803ce4853cd829c0d8fe6875371ee39cebbae
This commit is contained in:
Pradeep Kumar Singh 2015-07-01 04:05:54 +05:30
parent 2debd0cc08
commit 717bd9ff9b
1 changed files with 14 additions and 14 deletions

View File

@ -52,8 +52,8 @@ class AgentRequestHandlerTest(AgentTestCase):
# ;ANSWER
# ;AUTHORITY
# ;ADDITIONAL
expected_response = ("1a72a4000001000000000000076578616d706c650363"
"6f6d0000060001")
expected_response = (b"1a72a4000001000000000000076578616d706c6503"
b"636f6d0000060001")
request = dns.message.from_wire(binascii.a2b_hex(payload))
request.environ = {'addr': ["0.0.0.0", 1234]}
response = next(self.handler(request)).to_wire()
@ -73,8 +73,8 @@ class AgentRequestHandlerTest(AgentTestCase):
# ;ANSWER
# ;AUTHORITY
# ;ADDITIONAL
expected_response = ("2435a0050001000000000000076578616d706c6503636f6d"
"0000060001")
expected_response = (b"2435a0050001000000000000076578616d706c6503636f"
b"6d0000060001")
request = dns.message.from_wire(binascii.a2b_hex(payload))
# Bad 'requester'
request.environ = {'addr': ["6.6.6.6", 1234]}
@ -100,8 +100,8 @@ class AgentRequestHandlerTest(AgentTestCase):
# ;ANSWER
# ;AUTHORITY
# ;ADDITIONAL
expected_response = ("735df4000001000000000000076578616d706c6503636f6d"
"00ff02ff00")
expected_response = (b"735df4000001000000000000076578616d706c6503636f"
b"6d00ff02ff00")
request = dns.message.from_wire(binascii.a2b_hex(payload))
request.environ = {'addr': ["0.0.0.0", 1234]}
with mock.patch.object(
@ -125,8 +125,8 @@ class AgentRequestHandlerTest(AgentTestCase):
# ;ANSWER
# ;AUTHORITY
# ;ADDITIONAL
expected_response = ("8dfdf0050001000000000000076578616d706c6503636f6d"
"00ff02ff00")
expected_response = (b"8dfdf0050001000000000000076578616d706c6503636f"
b"6d00ff02ff00")
request = dns.message.from_wire(binascii.a2b_hex(payload))
# Bad 'requester'
request.environ = {'addr': ["6.6.6.6", 1234]}
@ -150,8 +150,8 @@ class AgentRequestHandlerTest(AgentTestCase):
# ;ANSWER
# ;AUTHORITY
# ;ADDITIONAL
expected_response = ("3b99f4000001000000000000076578616d706c6503636f6d"
"00ff03ff00")
expected_response = (b"3b99f4000001000000000000076578616d706c6503636f"
b"6d00ff03ff00")
request = dns.message.from_wire(binascii.a2b_hex(payload))
request.environ = {'addr': ["0.0.0.0", 1234]}
response = next(self.handler(request)).to_wire()
@ -173,8 +173,8 @@ class AgentRequestHandlerTest(AgentTestCase):
# ;ANSWER
# ;AUTHORITY
# ;ADDITIONAL
expected_response = ("e6daf0050001000000000000076578616d706c6503636f6d"
"00ff03ff00")
expected_response = (b"e6daf0050001000000000000076578616d706c6503636f"
b"6d00ff03ff00")
request = dns.message.from_wire(binascii.a2b_hex(payload))
# Bad 'requester'
request.environ = {'addr': ["6.6.6.6", 1234]}
@ -199,8 +199,8 @@ class AgentRequestHandlerTest(AgentTestCase):
# ;ANSWER
# ;AUTHORITY
# ;ADDITIONAL
expected_response = ("735df4000001000000000000076578616d706c6503636f6d"
"00ff02ff00")
expected_response = (b"735df4000001000000000000076578616d706c6503636f"
b"6d00ff02ff00")
request = dns.message.from_wire(binascii.a2b_hex(payload))
request.environ = {'addr': ["0.0.0.0", 1234]}
with mock.patch.object(