Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sailhouse/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async def pull(
"""Pull an event from a subscription, locking it for processing"""
url = f"{self.BASE_URL}/topics/{topic}/subscriptions/{subscription}/events/pull"

response = self.session.post(url, timeout=self.timeout)
response = self.session.get(url, timeout=self.timeout)
if response.status_code == 204:
return None

Expand Down
6 changes: 3 additions & 3 deletions test/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ async def test_pull_success(client, mock_response):
"data": {"message": "test1"}
}

with patch.object(client.session, 'post', return_value=mock_response(200, test_event)):
with patch.object(client.session, 'get', return_value=mock_response(200, test_event)):
event = await client.pull("test-topic", "test-sub")

assert isinstance(event, Event)
Expand All @@ -160,14 +160,14 @@ async def test_pull_success(client, mock_response):

@pytest.mark.asyncio
async def test_pull_no_message(client, mock_response):
with patch.object(client.session, 'post', return_value=mock_response(204)):
with patch.object(client.session, 'get', return_value=mock_response(204)):
event = await client.pull("test-topic", "test-sub")
assert event is None


@pytest.mark.asyncio
async def test_pull_failure(client, mock_response):
with patch.object(client.session, 'post', return_value=mock_response(400, {})):
with patch.object(client.session, 'get', return_value=mock_response(400, {})):
with pytest.raises(SailhouseError):
await client.pull("test-topic", "test-sub")

Expand Down
Loading