def test_get_subscription_exception(self): # Mock the API response channel = ChannelStub(responses=[CustomException()]) patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = subscriber_client.SubscriberClient() # Setup request subscription = client.subscription_path("[PROJECT]", "[SUBSCRIPTION]") with pytest.raises(CustomException): client.get_subscription(subscription)
def test_modify_ack_deadline_exception(self): # Mock the API response channel = ChannelStub(responses=[CustomException()]) patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = subscriber_client.SubscriberClient() # Setup request subscription = client.subscription_path("[PROJECT]", "[SUBSCRIPTION]") ack_ids = [] ack_deadline_seconds = 2135351438 with pytest.raises(CustomException): client.modify_ack_deadline(subscription, ack_ids, ack_deadline_seconds)