Skip to content

Commit 7884ab3

Browse files
committed
Updating the netstring tests.
1 parent c18670d commit 7884ab3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

examples/test_netstrings.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,19 @@ def test_sending_two_netstrings():
5353

5454

5555
class FakeState(object):
56-
def __init__(self, sender):
56+
def __init__(self, sender, parser):
5757
self.sender = sender
58+
self.parser = parser
5859
self.netstrings = []
60+
self.connected = False
5961
self.lossReason = None
6062

6163
def netstringReceived(self, s):
6264
self.netstrings.append(s)
6365

66+
def connectionMade(self):
67+
self.connected = True
68+
6469
def connectionLost(self, reason):
6570
self.lossReason = reason
6671

@@ -101,6 +106,11 @@ def test_receiving_two_netstrings_at_once():
101106
protocol.dataReceived('4:spam,4:eggs,')
102107
assert protocol.state.netstrings == ['spam', 'eggs']
103108

109+
def test_establishing_connection():
110+
assert not FakeState(None, None).connected
111+
protocol, transport = build_testing_protocol()
112+
assert protocol.state.connected
113+
104114
def test_losing_connection():
105115
protocol, transport = build_testing_protocol()
106116
reason = object()

0 commit comments

Comments
 (0)