Skip to content

Commit 75739d3

Browse files
rename test webhook view to avoid pytest collection
1 parent 208ba8c commit 75739d3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/test_views.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from django.http import JsonResponse
1212
from django.utils import timezone
1313
from gidgethub import sansio
14+
from gidgethub.abc import GitHubAPI
1415
from model_bakery import baker
1516

1617
from django_github_app.github import AsyncGitHubAPI
@@ -75,7 +76,9 @@ def test_router():
7576
GitHubRouter._routers.remove(router.router)
7677

7778

78-
class TestWebhookView(BaseWebhookView):
79+
class WebhookView(BaseWebhookView[GitHubAPI]):
80+
github_api_class = GitHubAPI
81+
7982
def post(self, request):
8083
return JsonResponse({})
8184

@@ -87,7 +90,7 @@ def test_get_event(self, webhook_request):
8790
delivery_id = 4321
8891

8992
request = webhook_request(event_type, body, delivery_id)
90-
view = TestWebhookView()
93+
view = WebhookView()
9194
event = view.get_event(request)
9295

9396
assert isinstance(event, sansio.Event)
@@ -98,7 +101,7 @@ def test_get_event(self, webhook_request):
98101
# @pytest.mark.parametrize("github_api_class", [AsyncGitHubAPI, SyncGitHubAPI])
99102
# def test_get_github_api_async(self, github_api_class, installation):
100103
def test_get_github_api_async(self, installation):
101-
view = TestWebhookView()
104+
view = WebhookView()
102105
view.github_api_class = AsyncGitHubAPI
103106

104107
gh = view.get_github_api(installation)
@@ -107,14 +110,14 @@ def test_get_github_api_async(self, installation):
107110
assert gh.installation_id == installation.installation_id
108111

109112
def test_get_github_api_sync(self, installation):
110-
view = TestWebhookView()
113+
view = WebhookView()
111114
view.github_api_class = SyncGitHubAPI
112115

113116
with pytest.raises(NotImplementedError):
114117
view.get_github_api(installation)
115118

116119
def test_get_response(self, webhook_request):
117-
view = TestWebhookView()
120+
view = WebhookView()
118121

119122
response = view.get_response(baker.make("django_github_app.EventLog"))
120123

0 commit comments

Comments
 (0)