@@ -33,7 +33,7 @@ def test_publisher_api(self):
3333 from gcloud .pubsub .connection import _PublisherAPI
3434 creds = _Credentials ()
3535 client = self ._makeOne (project = self .PROJECT , credentials = creds )
36- conn = client .connection = _Connection ()
36+ conn = client .connection = object ()
3737 api = client .publisher_api
3838 self .assertIsInstance (api , _PublisherAPI )
3939 self .assertTrue (api ._connection is conn )
@@ -45,7 +45,7 @@ def test_subscriber_api(self):
4545 from gcloud .pubsub .connection import _SubscriberAPI
4646 creds = _Credentials ()
4747 client = self ._makeOne (project = self .PROJECT , credentials = creds )
48- conn = client .connection = _Connection ()
48+ conn = client .connection = object ()
4949 api = client .subscriber_api
5050 self .assertIsInstance (api , _SubscriberAPI )
5151 self .assertTrue (api ._connection is conn )
@@ -57,7 +57,7 @@ def test_iam_policy_api(self):
5757 from gcloud .pubsub .connection import _IAMPolicyAPI
5858 creds = _Credentials ()
5959 client = self ._makeOne (project = self .PROJECT , credentials = creds )
60- conn = client .connection = _Connection ()
60+ conn = client .connection = object ()
6161 api = client .iam_policy_api
6262 self .assertIsInstance (api , _IAMPolicyAPI )
6363 self .assertTrue (api ._connection is conn )
@@ -69,7 +69,7 @@ def test_list_topics_no_paging(self):
6969 from gcloud .pubsub .topic import Topic
7070 creds = _Credentials ()
7171 client = self ._makeOne (project = self .PROJECT , credentials = creds )
72- conn = client .connection = _Connection ()
72+ client .connection = object ()
7373 api = client ._publisher_api = _FauxPublisherAPI ()
7474 api ._list_topics_response = [{'name' : self .TOPIC_PATH }], None
7575
@@ -80,7 +80,6 @@ def test_list_topics_no_paging(self):
8080 self .assertEqual (topics [0 ].name , self .TOPIC_NAME )
8181 self .assertEqual (next_page_token , None )
8282
83- self .assertEqual (len (conn ._requested ), 0 )
8483 self .assertEqual (api ._listed_topics , (self .PROJECT , None , None ))
8584
8685 def test_list_topics_with_paging (self ):
@@ -90,7 +89,7 @@ def test_list_topics_with_paging(self):
9089 SIZE = 1
9190 creds = _Credentials ()
9291 client = self ._makeOne (project = self .PROJECT , credentials = creds )
93- conn = client .connection = _Connection ()
92+ client .connection = object ()
9493 api = client ._publisher_api = _FauxPublisherAPI ()
9594 api ._list_topics_response = [{'name' : self .TOPIC_PATH }], TOKEN2
9695
@@ -101,13 +100,12 @@ def test_list_topics_with_paging(self):
101100 self .assertEqual (topics [0 ].name , self .TOPIC_NAME )
102101 self .assertEqual (next_page_token , TOKEN2 )
103102
104- self .assertEqual (len (conn ._requested ), 0 )
105103 self .assertEqual (api ._listed_topics , (self .PROJECT , 1 , TOKEN1 ))
106104
107105 def test_list_topics_missing_key (self ):
108106 creds = _Credentials ()
109107 client = self ._makeOne (project = self .PROJECT , credentials = creds )
110- conn = client .connection = _Connection ()
108+ client .connection = object ()
111109 api = client ._publisher_api = _FauxPublisherAPI ()
112110 api ._list_topics_response = (), None
113111
@@ -116,15 +114,14 @@ def test_list_topics_missing_key(self):
116114 self .assertEqual (len (topics ), 0 )
117115 self .assertEqual (next_page_token , None )
118116
119- self .assertEqual (len (conn ._requested ), 0 )
120117 self .assertEqual (api ._listed_topics , (self .PROJECT , None , None ))
121118
122119 def test_list_subscriptions_no_paging (self ):
123120 from gcloud .pubsub .subscription import Subscription
124121 SUB_INFO = {'name' : self .SUB_PATH , 'topic' : self .TOPIC_PATH }
125122 creds = _Credentials ()
126123 client = self ._makeOne (project = self .PROJECT , credentials = creds )
127- conn = client .connection = _Connection ()
124+ client .connection = object ()
128125 api = client ._subscriber_api = _FauxSubscriberAPI ()
129126 api ._list_subscriptions_response = [SUB_INFO ], None
130127
@@ -136,7 +133,6 @@ def test_list_subscriptions_no_paging(self):
136133 self .assertEqual (subscriptions [0 ].topic .name , self .TOPIC_NAME )
137134 self .assertEqual (next_page_token , None )
138135
139- self .assertEqual (len (conn ._requested ), 0 )
140136 self .assertEqual (api ._listed_subscriptions ,
141137 (self .PROJECT , None , None ))
142138
@@ -154,7 +150,7 @@ def test_list_subscriptions_with_paging(self):
154150 TOKEN1 = 'TOKEN1'
155151 TOKEN2 = 'TOKEN2'
156152 SIZE = 1
157- conn = client .connection = _Connection ()
153+ client .connection = object ()
158154 api = client ._subscriber_api = _FauxSubscriberAPI ()
159155 api ._list_subscriptions_response = [SUB_INFO ], TOKEN2
160156
@@ -169,7 +165,6 @@ def test_list_subscriptions_with_paging(self):
169165 self .assertEqual (subscriptions [0 ].push_endpoint , PUSH_ENDPOINT )
170166 self .assertEqual (next_page_token , TOKEN2 )
171167
172- self .assertEqual (len (conn ._requested ), 0 )
173168 self .assertEqual (api ._listed_subscriptions ,
174169 (self .PROJECT , SIZE , TOKEN1 ))
175170
@@ -178,7 +173,7 @@ def test_list_subscriptions_w_missing_key(self):
178173 creds = _Credentials ()
179174
180175 client = self ._makeOne (project = PROJECT , credentials = creds )
181- conn = client .connection = _Connection ()
176+ client .connection = object ()
182177 api = client ._subscriber_api = _FauxSubscriberAPI ()
183178 api ._list_subscriptions_response = (), None
184179
@@ -187,7 +182,6 @@ def test_list_subscriptions_w_missing_key(self):
187182 self .assertEqual (len (subscriptions ), 0 )
188183 self .assertEqual (next_page_token , None )
189184
190- self .assertEqual (len (conn ._requested ), 0 )
191185 self .assertEqual (api ._listed_subscriptions ,
192186 (self .PROJECT , None , None ))
193187
@@ -231,10 +225,3 @@ class _FauxSubscriberAPI(object):
231225 def list_subscriptions (self , project , page_size , page_token ):
232226 self ._listed_subscriptions = (project , page_size , page_token )
233227 return self ._list_subscriptions_response
234-
235-
236- class _Connection (object ):
237-
238- def __init__ (self , * responses ):
239- self ._responses = responses
240- self ._requested = []
0 commit comments