[tor-commits] [bridgedb/develop] Turn str into bytes in SMTP unit test.
phw at torproject.org
phw at torproject.org
Wed Feb 19 18:27:18 UTC 2020
commit b0c74f0ae932fffcd260eb26fd6594968b11908b
Author: Philipp Winter <phw at nymity.ch>
Date: Wed Jan 29 17:58:03 2020 -0800
Turn str into bytes in SMTP unit test.
This should fix the following unit test errors:
[ERROR]
Traceback (most recent call last):
File "/home/travis/build/NullHypothesis/bridgedb/bridgedb/test/test_smtp.py", line 155, in test_getBridges
self.server.getAndCheckMessageContains("Here are your bridges")
File "/home/travis/build/NullHypothesis/bridgedb/bridgedb/test/test_smtp.py", line 99, in getAndCheckMessageContains
assert message.find(text) != -1, ("Message did not contain text '%s'."
builtins.TypeError: argument should be integer or bytes-like object, not 'str'
bridgedb.test.test_smtp.SMTPTests.test_getBridges
===============================================================================
[ERROR]
Traceback (most recent call last):
File "/home/travis/build/NullHypothesis/bridgedb/bridgedb/test/test_smtp.py", line 171, in test_getBridges_rateLimitExceeded
self.server.getAndCheckMessageContains("Here are your bridges")
File "/home/travis/build/NullHypothesis/bridgedb/bridgedb/test/test_smtp.py", line 99, in getAndCheckMessageContains
assert message.find(text) != -1, ("Message did not contain text '%s'."
builtins.TypeError: argument should be integer or bytes-like object, not 'str'
bridgedb.test.test_smtp.SMTPTests.test_getBridges_rateLimitExceeded
===============================================================================
[ERROR]
Traceback (most recent call last):
File "/home/travis/build/NullHypothesis/bridgedb/bridgedb/test/test_smtp.py", line 206, in test_getBridges_stressTest
self.server.getAndCheckMessageContains("Here are your bridges")
File "/home/travis/build/NullHypothesis/bridgedb/bridgedb/test/test_smtp.py", line 99, in getAndCheckMessageContains
assert message.find(text) != -1, ("Message did not contain text '%s'."
builtins.TypeError: argument should be integer or bytes-like object, not 'str'
---
bridgedb/test/test_smtp.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/bridgedb/test/test_smtp.py b/bridgedb/test/test_smtp.py
index 3fd06f3..f7261da 100644
--- a/bridgedb/test/test_smtp.py
+++ b/bridgedb/test/test_smtp.py
@@ -152,7 +152,7 @@ class SMTPTests(unittest.TestCase):
# then check that our local SMTP server received a response
# and that response contained some bridges
- self.server.getAndCheckMessageContains("Here are your bridges")
+ self.server.getAndCheckMessageContains(b"Here are your bridges")
def test_getBridges_rateLimitExceeded(self):
if os.environ.get("CI"):
@@ -168,14 +168,14 @@ class SMTPTests(unittest.TestCase):
# then check that our local SMTP server received a response
# and that response contained some bridges
- self.server.getAndCheckMessageContains("Here are your bridges")
+ self.server.getAndCheckMessageContains(b"Here are your bridges")
# send another request from the same email address
sendMail(FROM_ADDRESS)
# this time, the email response should not contain any bridges
self.server.getAndCheckMessageContains(
- "You have exceeded the rate limit. Please slow down!")
+ b"You have exceeded the rate limit. Please slow down!")
# then we send another request from the same email address
sendMail(FROM_ADDRESS)
@@ -203,4 +203,4 @@ class SMTPTests(unittest.TestCase):
% random.randint(MIN_FROM_ADDRESS, MAX_FROM_ADDRESS))
for i in range(NUM_MAILS):
- self.server.getAndCheckMessageContains("Here are your bridges")
+ self.server.getAndCheckMessageContains(b"Here are your bridges")
More information about the tor-commits
mailing list