render empty token correctly
This commit is contained in:
parent
aa58b85ace
commit
bfd8312ef0
|
@ -178,10 +178,11 @@ class TransitServerState(object):
|
|||
d = "-"
|
||||
if self._token is not None:
|
||||
d = self._token[:16].decode("ascii")
|
||||
if self._side is not None:
|
||||
d += "-" + self._side.decode("ascii")
|
||||
else:
|
||||
d += "-<unsided>"
|
||||
|
||||
if self._side is not None:
|
||||
d += "-" + self._side.decode("ascii")
|
||||
else:
|
||||
d += "-<unsided>"
|
||||
return d
|
||||
|
||||
@_machine.input()
|
||||
|
|
|
@ -22,6 +22,7 @@ from ..usage import (
|
|||
)
|
||||
from ..transit_server import (
|
||||
WebSocketTransitConnection,
|
||||
TransitServerState,
|
||||
)
|
||||
|
||||
|
||||
|
@ -677,3 +678,18 @@ class UsageWebSockets(Usage):
|
|||
)
|
||||
self._pumps.append(pump)
|
||||
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