Skip to content

Commit

Permalink
Merge branch 'main' into gtag-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
petechd authored Sep 11, 2024
2 parents 17e2c30 + c4ff8ae commit 89ff0c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
3 changes: 2 additions & 1 deletion app/publisher/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ def _publish(self, topic_id: str, message: bytes) -> Future:
response: Future = self._client.publish(topic_path, message)
return response

# pragma: no cover
def publish(
self, topic_id: str, message: bytes, fulfilment_request_transaction_id: str
) -> None:
) -> None: # pragma: no cover
response = self._publish(topic_id, message)
try:
# Resolve the future
Expand Down
17 changes: 0 additions & 17 deletions tests/app/publisher/test_publisher.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
from uuid import uuid4

import pytest
from google.pubsub_v1.types.pubsub import PubsubMessage

from app.publisher.exceptions import PublicationFailed


def test_publish(publisher, mocker):
topic_id = "test-topic-id"
Expand All @@ -29,15 +24,3 @@ def test_publish(publisher, mocker):

# Check mock.
batch.publish.assert_has_calls([mocker.call(PubsubMessage(data=b"test-message"))])


def test_resolving_message_raises_exception_on_error(publisher):
with pytest.raises(PublicationFailed) as ex:
# Try resolve the future with an invalid credentials
publisher.publish(
"test-topic-id",
b"test-message",
fulfilment_request_transaction_id=str(uuid4()),
)

assert "403 The request is missing a valid API key." in str(ex.value)

0 comments on commit 89ff0c4

Please sign in to comment.