Fix empty string check for python 3
It's '' in py2 and b'' in py3. See bug for traceback. Closes-Bug: #1657476 Change-Id: Ic2c32669bf238b702e13e81e15dd079d538a6abc
This commit is contained in:
parent
1111fc61a1
commit
7953e9886d
|
@ -402,7 +402,7 @@ class UnixDomainHttpProtocol(eventlet.wsgi.HttpProtocol):
|
|||
disable_nagle_algorithm = False
|
||||
|
||||
def __init__(self, request, client_address, server):
|
||||
if client_address == '':
|
||||
if not client_address:
|
||||
client_address = ('<local>', 0)
|
||||
# base class is old-style, so super does not work properly
|
||||
eventlet.wsgi.HttpProtocol.__init__(self, request, client_address,
|
||||
|
|
|
@ -468,8 +468,9 @@ class TestUnixDomainHttpConnection(base.BaseTestCase):
|
|||
|
||||
class TestUnixDomainHttpProtocol(base.BaseTestCase):
|
||||
def test_init_empty_client(self):
|
||||
u = utils.UnixDomainHttpProtocol(mock.Mock(), '', mock.Mock())
|
||||
self.assertEqual(u.client_address, ('<local>', 0))
|
||||
for addr in ('', b''):
|
||||
u = utils.UnixDomainHttpProtocol(mock.Mock(), addr, mock.Mock())
|
||||
self.assertEqual(u.client_address, ('<local>', 0))
|
||||
|
||||
def test_init_with_client(self):
|
||||
u = utils.UnixDomainHttpProtocol(mock.Mock(), 'foo', mock.Mock())
|
||||
|
|
Loading…
Reference in New Issue