File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -53,14 +53,19 @@ def test_sending_two_netstrings():
53
53
54
54
55
55
class FakeState (object ):
56
- def __init__ (self , sender ):
56
+ def __init__ (self , sender , parser ):
57
57
self .sender = sender
58
+ self .parser = parser
58
59
self .netstrings = []
60
+ self .connected = False
59
61
self .lossReason = None
60
62
61
63
def netstringReceived (self , s ):
62
64
self .netstrings .append (s )
63
65
66
+ def connectionMade (self ):
67
+ self .connected = True
68
+
64
69
def connectionLost (self , reason ):
65
70
self .lossReason = reason
66
71
@@ -101,6 +106,11 @@ def test_receiving_two_netstrings_at_once():
101
106
protocol .dataReceived ('4:spam,4:eggs,' )
102
107
assert protocol .state .netstrings == ['spam' , 'eggs' ]
103
108
109
+ def test_establishing_connection ():
110
+ assert not FakeState (None , None ).connected
111
+ protocol , transport = build_testing_protocol ()
112
+ assert protocol .state .connected
113
+
104
114
def test_losing_connection ():
105
115
protocol , transport = build_testing_protocol ()
106
116
reason = object ()
You can’t perform that action at this time.
0 commit comments