[tor-commits] [bridgedb/master] Turn hostname from str into bytes.
phw at torproject.org
phw at torproject.org
Wed Feb 19 18:26:38 UTC 2020
commit 4a7f7de90c24fc583325892f44103eca1004fc3e
Author: Philipp Winter <phw at nymity.ch>
Date: Thu Jan 30 17:31:32 2020 -0800
Turn hostname from str into bytes.
This fixes the following two failed unit tests:
===============================================================================
[FAIL]
Traceback (most recent call last):
File "/home/travis/build/NullHypothesis/bridgedb/bridgedb/test/test_email_server.py", line 549, in test_addServer
noisy=True)
File "/home/travis/build/NullHypothesis/bridgedb/bridgedb/test/test_email_server.py", line 381, in _test
self.assertSubstring(expected, recv)
File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/twisted/trial/_synctest.py", line 571, in assertSubstring
return self.failUnlessIn(substring, astring, msg)
File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/twisted/trial/_synctest.py", line 492, in assertIn
% (containee, container))
twisted.trial.unittest.FailTest: '250 Delivery in progress' not in '220 bridges.torproject.org NO UCE NO UBE NO RELAY PROBES\r\n250 bridges.torproject.org Hello 192.168.1.1, nice to meet you\r\n550 Cannot receive from specified address <testing at travis-job-29d1fb7f-84ab-4139-977c-5f18fc201f57>: Sender not acceptable\r\n503 Must have sender before recipient\r\n503 Must have valid receiver and originator\r\n500 Command not implemented\r\n500 Command not implemented\r\n500 Command not implemented\r\n500 Error: bad syntax\r\n500 Command not implemented\r\n500 Command not implemented\r\n'
bridgedb.test.test_email_server.EmailServerServiceTests.test_addServer
===============================================================================
[FAIL]
Traceback (most recent call last):
File "/home/travis/build/NullHypothesis/bridgedb/bridgedb/test/test_email_server.py", line 422, in test_SMTPIncomingServerFactory_MAIL_FROM_testing_at_gethostname
"250 Sender address accepted")
File "/home/travis/build/NullHypothesis/bridgedb/bridgedb/test/test_email_server.py", line 381, in _test
self.assertSubstring(expected, recv)
File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/twisted/trial/_synctest.py", line 571, in assertSubstring
return self.failUnlessIn(substring, astring, msg)
File "/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/twisted/trial/_synctest.py", line 492, in assertIn
% (containee, container))
twisted.trial.unittest.FailTest: '250 Sender address accepted' not in '220 bridges.torproject.org NO UCE NO UBE NO RELAY PROBES\r\n250 bridges.torproject.org Hello 192.168.1.1, nice to meet you\r\n550 Cannot receive from specified address <testing at travis-job-29d1fb7f-84ab-4139-977c-5f18fc201f57>: Sender not acceptable\r\n'
bridgedb.test.test_email_server.SMTPIncomingServerFactoryTests.test_SMTPIncomingServerFactory_MAIL_FROM_testing_at_gethostname
===============================================================================
---
bridgedb/distributors/email/server.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bridgedb/distributors/email/server.py b/bridgedb/distributors/email/server.py
index 38ed988..063b640 100644
--- a/bridgedb/distributors/email/server.py
+++ b/bridgedb/distributors/email/server.py
@@ -126,7 +126,7 @@ class MailServerContext(object):
self.nBridges = config.EMAIL_N_BRIDGES_PER_ANSWER
self.username = (config.EMAIL_USERNAME or "bridges")
- self.hostname = socket.gethostname()
+ self.hostname = socket.gethostname().encode("utf-8")
self.fromAddr = (config.EMAIL_FROM_ADDR or "bridges at torproject.org")
self.smtpFromAddr = (config.EMAIL_SMTP_FROM_ADDR or self.fromAddr)
self.smtpServerPort = (config.EMAIL_SMTP_PORT or 25)
More information about the tor-commits
mailing list