Skip to content

Commit

Permalink
server: add test to validate pull_request.edited payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
zegl committed Apr 21, 2023
1 parent f84c7d3 commit 0b7f4f3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions server/tests/integrations/github/tasks/test_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,25 @@ async def test_webhook_pull_request_opened(
assert pr.deletions == 1


@pytest.mark.asyncio
async def test_webhook_pull_request_edited(
mocker: MockerFixture, session: AsyncSession, github_webhook: TestWebhookFactory
) -> None:
# Capture and prevent any calls to enqueue_job
mocker.patch("arq.connections.ArqRedis.enqueue_job")

hook = github_webhook.create("pull_request.edited")
pr_id = hook["pull_request"]["id"]

pr = await service.github_pull_request.get_by_external_id(session, pr_id)
assert pr is None

await create_repositories(github_webhook)
hook = github_webhook.create("pull_request.edited")
await webhook_tasks.pull_request_edited(
FAKE_CTX, "pull_request", "edited", hook.json
)

@pytest.mark.asyncio
async def test_webhook_pull_request_synchronize(
mocker: MockerFixture,
Expand Down

0 comments on commit 0b7f4f3

Please sign in to comment.