Unverified Commit 4a7f7de9 authored by Philipp Winter's avatar Philipp Winter
Browse files

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@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@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
===============================================================================
parent 29c2bd17
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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@torproject.org")
        self.smtpFromAddr = (config.EMAIL_SMTP_FROM_ADDR or self.fromAddr)
        self.smtpServerPort = (config.EMAIL_SMTP_PORT or 25)