From 2ae03043b7898df771bcf5973bce7dec29bc77d8 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Thu, 19 Nov 2020 12:04:02 -0500 Subject: [PATCH] Another passing Python 3 test. --- src/allmydata/test/test_introducer.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/allmydata/test/test_introducer.py b/src/allmydata/test/test_introducer.py index 55ea02229..60dd2dbb6 100644 --- a/src/allmydata/test/test_introducer.py +++ b/src/allmydata/test/test_introducer.py @@ -1,3 +1,4 @@ +from past.builtins import unicode from six import ensure_binary, ensure_text import os, re, itertools @@ -908,7 +909,9 @@ class ClientSeqnums(AsyncBrokenTestCase): self.failUnless("sA" in outbound) self.failUnlessEqual(outbound["sA"]["seqnum"], 1) nonce1 = outbound["sA"]["nonce"] - self.failUnless(isinstance(nonce1, str)) + self.failUnless(isinstance(nonce1, bytes)) + # Make nonce unicode, to match JSON: + outbound["sA"]["nonce"] = unicode(nonce1, "utf-8") self.failUnlessEqual(json.loads(published["sA"][0]), outbound["sA"]) # [1] is the signature, [2] is the pubkey @@ -922,8 +925,11 @@ class ClientSeqnums(AsyncBrokenTestCase): self.failUnless("sA" in outbound) self.failUnlessEqual(outbound["sA"]["seqnum"], 2) nonce2 = outbound["sA"]["nonce"] - self.failUnless(isinstance(nonce2, str)) + self.failUnless(isinstance(nonce2, bytes)) self.failIfEqual(nonce1, nonce2) + # Make nonce unicode, to match JSON: + outbound["sA"]["nonce"] = unicode(nonce2, "utf-8") + outbound["sB"]["nonce"] = unicode(outbound["sB"]["nonce"], "utf-8") self.failUnlessEqual(json.loads(published["sA"][0]), outbound["sA"]) self.failUnlessEqual(json.loads(published["sB"][0]),