render empty token correctly
This commit is contained in:
parent
aa58b85ace
commit
bfd8312ef0
|
@ -178,10 +178,11 @@ class TransitServerState(object):
|
||||||
d = "-"
|
d = "-"
|
||||||
if self._token is not None:
|
if self._token is not None:
|
||||||
d = self._token[:16].decode("ascii")
|
d = self._token[:16].decode("ascii")
|
||||||
if self._side is not None:
|
|
||||||
d += "-" + self._side.decode("ascii")
|
if self._side is not None:
|
||||||
else:
|
d += "-" + self._side.decode("ascii")
|
||||||
d += "-<unsided>"
|
else:
|
||||||
|
d += "-<unsided>"
|
||||||
return d
|
return d
|
||||||
|
|
||||||
@_machine.input()
|
@_machine.input()
|
||||||
|
|
|
@ -22,6 +22,7 @@ from ..usage import (
|
||||||
)
|
)
|
||||||
from ..transit_server import (
|
from ..transit_server import (
|
||||||
WebSocketTransitConnection,
|
WebSocketTransitConnection,
|
||||||
|
TransitServerState,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -677,3 +678,18 @@ class UsageWebSockets(Usage):
|
||||||
)
|
)
|
||||||
self._pumps.append(pump)
|
self._pumps.append(pump)
|
||||||
return client_protocol
|
return client_protocol
|
||||||
|
|
||||||
|
|
||||||
|
class State(unittest.TestCase):
|
||||||
|
"""
|
||||||
|
Tests related to server_state.TransitServerState
|
||||||
|
"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.state = TransitServerState(None, None)
|
||||||
|
|
||||||
|
def test_empty_token(self):
|
||||||
|
self.assertEqual(
|
||||||
|
"-",
|
||||||
|
self.state.get_token(),
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user