Skip to content

Commit

Permalink
add tests for cov
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrishabh17 committed Jan 16, 2025
1 parent f96eebf commit 2059b57
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/workspaces/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
urlpatterns = [
path('', WorkspaceView.as_view(), name='workspaces'),
path('ready/', ReadyView.as_view(), name='ready'),
path('webhook_callback/', WebhookCallbackView.as_view(), name='qbd_direct_webhook_callback'),
path('webhook_callback/', WebhookCallbackView.as_view(), name='workspace_webhook_callback'),
path('<int:workspace_id>/export_settings/', ExportSettingView.as_view(), name='export-settings'),
path('<int:workspace_id>/advanced_settings/', AdvancedSettingView.as_view(), name='advanced-settings'),
path('<int:workspace_id>/field_mappings/', FieldMappingView.as_view(), name='field-mappings'),
Expand Down
19 changes: 19 additions & 0 deletions tests/test_workspaces/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,22 @@ def test_ready_view(api_client, test_connection):
response = api_client.get(url)

assert response.status_code == 200


def test_webhook_callback_view(
db,
mocker,
api_client,
test_connection,
create_temp_workspace
):
"""
Test post webhook callback
"""
async_task = mocker.patch('apps.workspaces.views.async_task')
url = reverse('workspace_webhook_callback')
api_client.credentials(HTTP_AUTHORIZATION='Bearer {}'.format(test_connection.access_token))
response = api_client.post(url)

assert response.status_code == 200
async_task.assert_called_once()

0 comments on commit 2059b57

Please sign in to comment.