Commit aea17c23 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

fixed test


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1871 e5f2f494-b856-4b98-b285-d166d9295462
parent a3888f31
......@@ -98,6 +98,7 @@ class MySession(Session):
self._sequence = 1
self._closed = False
self._queue = []
self._lock = threading.RLock()
try:
self._socket = MySocket(socket.AF_INET, socket.SOCK_STREAM)
......@@ -178,17 +179,12 @@ class testSession(unittest.TestCase):
# sending message {'to': 'someone', 'reply': 1}, {"hello": "a"}
#print("sending message {'to': 'someone', 'reply': 1}, {'hello': 'a'}")
# simply get the message without asking for a specific sequence number reply
# get no message without asking for a specific sequence number reply
self.assertFalse(sess.has_queued_msgs())
sess._socket.addrecv(b'\x00\x00\x00(\x00\x19Skan\x02to(\x07someone\x05reply&\x011Skan\x05hello(\x01a')
env, msg = sess.recvmsg(False)
self.assertEqual({'to': 'someone', 'reply': 1}, env)
self.assertEqual({"hello": "a"}, msg)
self.assertFalse(sess.has_queued_msgs())
# simply get the message, asking for a specific sequence number reply
self.assertFalse(sess.has_queued_msgs())
sess._socket.addrecv(b'\x00\x00\x00(\x00\x19Skan\x02to(\x07someone\x05reply&\x011Skan\x05hello(\x01a')
self.assertEqual(None, env)
self.assertTrue(sess.has_queued_msgs())
env, msg = sess.recvmsg(False, 1)
self.assertEqual({'to': 'someone', 'reply': 1}, env)
self.assertEqual({"hello": "a"}, msg)
......@@ -215,7 +211,7 @@ class testSession(unittest.TestCase):
self.assertEqual(None, env)
self.assertEqual(None, msg)
self.assertTrue(sess.has_queued_msgs())
env, msg = sess.recvmsg(False)
env, msg = sess.recvmsg(False, 1)
self.assertEqual({'to': 'someone', 'reply': 1}, env)
self.assertEqual({"hello": "a"}, msg)
self.assertFalse(sess.has_queued_msgs())
......@@ -223,7 +219,7 @@ class testSession(unittest.TestCase):
#print("sending message {'to': 'someone', 'reply': 1}, {'hello': 'a'}")
# ask for a differe sequence number reply (that doesn't exist)
# send a new message, ask for any message (get the first)
# send a new message, ask for specific message (get the first)
# then ask for any message (get the second)
self.assertFalse(sess.has_queued_msgs())
sess._socket.addrecv(b'\x00\x00\x00(\x00\x19Skan\x02to(\x07someone\x05reply&\x011Skan\x05hello(\x01a')
......@@ -232,8 +228,8 @@ class testSession(unittest.TestCase):
self.assertEqual(None, msg)
self.assertTrue(sess.has_queued_msgs())
sess._socket.addrecv(b'\x00\x00\x00\x1f\x00\x10Skan\x02to(\x07someoneSkan\x05hello(\x01b')
env, msg = sess.recvmsg(False)
self.assertEqual({'to': 'someone', 'reply': 1}, env)
env, msg = sess.recvmsg(False, 1)
self.assertEqual({'to': 'someone', 'reply': 1 }, env)
self.assertEqual({"hello": "a"}, msg)
self.assertFalse(sess.has_queued_msgs())
env, msg = sess.recvmsg(False)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment