diff --git a/webhooks/views.py b/webhooks/views.py index bedf2f0bb6..d289e75f16 100644 --- a/webhooks/views.py +++ b/webhooks/views.py @@ -108,7 +108,7 @@ def process_create_content_file_request(data): content_path = data.get("content_path") if etl_source == ETLSource.canvas.name: log.info("Processing Canvas content file: %s", content_path) - ingest_canvas_course.apply_async([content_path, True]) + ingest_canvas_course.apply_async([content_path, False]) def process_delete_content_file_request(data): diff --git a/webhooks/views_test.py b/webhooks/views_test.py index df5ad15853..86ddceb348 100644 --- a/webhooks/views_test.py +++ b/webhooks/views_test.py @@ -75,3 +75,25 @@ def test_content_file_delete_webhook_view_canvas_resource_not_found( assert response.status_code == 200 assert mock_log.warning.called assert "does not exist" in mock_log.warning.call_args[0][0] + + +@pytest.mark.django_db +def test_content_file_webhook_view_canvas_success(settings, client, mocker): + """ + Test ContentFileWebhookView processes Canvas create webhook successfully + """ + url = reverse("webhooks:v1:content_file_webhook") + mock_ingest = mocker.patch("webhooks.views.ingest_canvas_course.apply_async") + + data = { + "source": ETLSource.canvas.name, + "content_path": "/path/to/canvas/course.tar.gz", + } + response = client.post( + url, + data=json.dumps(data), + content_type="application/json", + headers={"X-MITLearn-Signature": get_secret(data, settings)}, + ) + assert response.status_code == 200 + mock_ingest.assert_called_once_with(["/path/to/canvas/course.tar.gz", False])