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 webhooks/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
22 changes: 22 additions & 0 deletions webhooks/views_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Loading