15
15
16
16
import pytest
17
17
18
- from google .cloud import pubsub_v1
18
+ from google .cloud . pubsub_v1 . gapic import publisher_client
19
19
from google .cloud .pubsub_v1 .proto import pubsub_pb2
20
20
from google .iam .v1 import iam_policy_pb2
21
21
from google .iam .v1 import policy_pb2
@@ -71,7 +71,7 @@ def test_create_topic(self):
71
71
72
72
# Mock the API response
73
73
channel = ChannelStub (responses = [expected_response ])
74
- client = pubsub_v1 .PublisherClient (channel = channel )
74
+ client = publisher_client .PublisherClient (channel = channel )
75
75
76
76
# Setup Request
77
77
name = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -87,7 +87,7 @@ def test_create_topic(self):
87
87
def test_create_topic_exception (self ):
88
88
# Mock the API response
89
89
channel = ChannelStub (responses = [CustomException ()])
90
- client = pubsub_v1 .PublisherClient (channel = channel )
90
+ client = publisher_client .PublisherClient (channel = channel )
91
91
92
92
# Setup request
93
93
name = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -103,7 +103,7 @@ def test_update_topic(self):
103
103
104
104
# Mock the API response
105
105
channel = ChannelStub (responses = [expected_response ])
106
- client = pubsub_v1 .PublisherClient (channel = channel )
106
+ client = publisher_client .PublisherClient (channel = channel )
107
107
108
108
# Setup Request
109
109
topic = {}
@@ -121,7 +121,7 @@ def test_update_topic(self):
121
121
def test_update_topic_exception (self ):
122
122
# Mock the API response
123
123
channel = ChannelStub (responses = [CustomException ()])
124
- client = pubsub_v1 .PublisherClient (channel = channel )
124
+ client = publisher_client .PublisherClient (channel = channel )
125
125
126
126
# Setup request
127
127
topic = {}
@@ -139,7 +139,7 @@ def test_publish(self):
139
139
140
140
# Mock the API response
141
141
channel = ChannelStub (responses = [expected_response ])
142
- client = pubsub_v1 .PublisherClient (channel = channel )
142
+ client = publisher_client .PublisherClient (channel = channel )
143
143
144
144
# Setup Request
145
145
topic = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -159,7 +159,7 @@ def test_publish(self):
159
159
def test_publish_exception (self ):
160
160
# Mock the API response
161
161
channel = ChannelStub (responses = [CustomException ()])
162
- client = pubsub_v1 .PublisherClient (channel = channel )
162
+ client = publisher_client .PublisherClient (channel = channel )
163
163
164
164
# Setup request
165
165
topic = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -178,7 +178,7 @@ def test_get_topic(self):
178
178
179
179
# Mock the API response
180
180
channel = ChannelStub (responses = [expected_response ])
181
- client = pubsub_v1 .PublisherClient (channel = channel )
181
+ client = publisher_client .PublisherClient (channel = channel )
182
182
183
183
# Setup Request
184
184
topic = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -194,7 +194,7 @@ def test_get_topic(self):
194
194
def test_get_topic_exception (self ):
195
195
# Mock the API response
196
196
channel = ChannelStub (responses = [CustomException ()])
197
- client = pubsub_v1 .PublisherClient (channel = channel )
197
+ client = publisher_client .PublisherClient (channel = channel )
198
198
199
199
# Setup request
200
200
topic = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -215,7 +215,7 @@ def test_list_topics(self):
215
215
216
216
# Mock the API response
217
217
channel = ChannelStub (responses = [expected_response ])
218
- client = pubsub_v1 .PublisherClient (channel = channel )
218
+ client = publisher_client .PublisherClient (channel = channel )
219
219
220
220
# Setup Request
221
221
project = client .project_path ('[PROJECT]' )
@@ -233,7 +233,7 @@ def test_list_topics(self):
233
233
234
234
def test_list_topics_exception (self ):
235
235
channel = ChannelStub (responses = [CustomException ()])
236
- client = pubsub_v1 .PublisherClient (channel = channel )
236
+ client = publisher_client .PublisherClient (channel = channel )
237
237
238
238
# Setup request
239
239
project = client .project_path ('[PROJECT]' )
@@ -256,7 +256,7 @@ def test_list_topic_subscriptions(self):
256
256
257
257
# Mock the API response
258
258
channel = ChannelStub (responses = [expected_response ])
259
- client = pubsub_v1 .PublisherClient (channel = channel )
259
+ client = publisher_client .PublisherClient (channel = channel )
260
260
261
261
# Setup Request
262
262
topic = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -275,7 +275,7 @@ def test_list_topic_subscriptions(self):
275
275
276
276
def test_list_topic_subscriptions_exception (self ):
277
277
channel = ChannelStub (responses = [CustomException ()])
278
- client = pubsub_v1 .PublisherClient (channel = channel )
278
+ client = publisher_client .PublisherClient (channel = channel )
279
279
280
280
# Setup request
281
281
topic = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -286,7 +286,7 @@ def test_list_topic_subscriptions_exception(self):
286
286
287
287
def test_delete_topic (self ):
288
288
channel = ChannelStub ()
289
- client = pubsub_v1 .PublisherClient (channel = channel )
289
+ client = publisher_client .PublisherClient (channel = channel )
290
290
291
291
# Setup Request
292
292
topic = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -301,7 +301,7 @@ def test_delete_topic(self):
301
301
def test_delete_topic_exception (self ):
302
302
# Mock the API response
303
303
channel = ChannelStub (responses = [CustomException ()])
304
- client = pubsub_v1 .PublisherClient (channel = channel )
304
+ client = publisher_client .PublisherClient (channel = channel )
305
305
306
306
# Setup request
307
307
topic = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -318,7 +318,7 @@ def test_set_iam_policy(self):
318
318
319
319
# Mock the API response
320
320
channel = ChannelStub (responses = [expected_response ])
321
- client = pubsub_v1 .PublisherClient (channel = channel )
321
+ client = publisher_client .PublisherClient (channel = channel )
322
322
323
323
# Setup Request
324
324
resource = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -336,7 +336,7 @@ def test_set_iam_policy(self):
336
336
def test_set_iam_policy_exception (self ):
337
337
# Mock the API response
338
338
channel = ChannelStub (responses = [CustomException ()])
339
- client = pubsub_v1 .PublisherClient (channel = channel )
339
+ client = publisher_client .PublisherClient (channel = channel )
340
340
341
341
# Setup request
342
342
resource = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -354,7 +354,7 @@ def test_get_iam_policy(self):
354
354
355
355
# Mock the API response
356
356
channel = ChannelStub (responses = [expected_response ])
357
- client = pubsub_v1 .PublisherClient (channel = channel )
357
+ client = publisher_client .PublisherClient (channel = channel )
358
358
359
359
# Setup Request
360
360
resource = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -371,7 +371,7 @@ def test_get_iam_policy(self):
371
371
def test_get_iam_policy_exception (self ):
372
372
# Mock the API response
373
373
channel = ChannelStub (responses = [CustomException ()])
374
- client = pubsub_v1 .PublisherClient (channel = channel )
374
+ client = publisher_client .PublisherClient (channel = channel )
375
375
376
376
# Setup request
377
377
resource = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -387,7 +387,7 @@ def test_test_iam_permissions(self):
387
387
388
388
# Mock the API response
389
389
channel = ChannelStub (responses = [expected_response ])
390
- client = pubsub_v1 .PublisherClient (channel = channel )
390
+ client = publisher_client .PublisherClient (channel = channel )
391
391
392
392
# Setup Request
393
393
resource = client .topic_path ('[PROJECT]' , '[TOPIC]' )
@@ -405,7 +405,7 @@ def test_test_iam_permissions(self):
405
405
def test_test_iam_permissions_exception (self ):
406
406
# Mock the API response
407
407
channel = ChannelStub (responses = [CustomException ()])
408
- client = pubsub_v1 .PublisherClient (channel = channel )
408
+ client = publisher_client .PublisherClient (channel = channel )
409
409
410
410
# Setup request
411
411
resource = client .topic_path ('[PROJECT]' , '[TOPIC]' )
0 commit comments