Skip to content

Commit 414699e

Browse files
committed
TST: Test error raised if trying to pull a BigQuery subscription
1 parent ea4cda3 commit 414699e

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

tests/cloud/pub_sub/test_service.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,25 @@ def test_timeout_error_raised_if_no_messages_received_when_waiting(self):
177177
with self.assertRaises(TimeoutError):
178178
service.wait_for_answer(subscription=mock_subscription, timeout=0.01)
179179

180-
def test_error_raised_if_attempting_to_wait_for_answer_from_push_subscription(self):
180+
def test_error_raised_if_attempting_to_wait_for_answer_from_non_pull_subscription(self):
181181
"""Test that an error is raised if attempting to wait for an answer from a push subscription."""
182-
mock_subscription = MockSubscription(
183-
name="world",
184-
topic=MockTopic(name="world", project_name=TEST_PROJECT_NAME),
185-
push_endpoint="https://example.com/endpoint",
186-
)
187-
188182
service = Service(backend=BACKEND)
189183

190-
with self.assertRaises(exceptions.NotAPullSubscription):
191-
service.wait_for_answer(subscription=mock_subscription)
184+
for subscription in [
185+
MockSubscription(
186+
name="world",
187+
topic=MockTopic(name="world", project_name=TEST_PROJECT_NAME),
188+
push_endpoint="https://example.com/endpoint",
189+
),
190+
MockSubscription(
191+
name="world",
192+
topic=MockTopic(name="world", project_name=TEST_PROJECT_NAME),
193+
bigquery_table_id="some-table",
194+
),
195+
]:
196+
with self.subTest(subscription=subscription):
197+
with self.assertRaises(exceptions.NotAPullSubscription):
198+
service.wait_for_answer(subscription=subscription)
192199

193200
def test_exceptions_in_responder_are_handled_and_sent_to_asker(self):
194201
"""Test that exceptions raised in the child service are handled and sent back to the asker."""

0 commit comments

Comments
 (0)