-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enableReadOnlyMode & refactor upload_url to a class #195
Changes from 1 commit
f339c61
5d15dae
4643ba8
3ce6306
b521d55
2ef957c
5e12536
53be1af
33d4647
2843e58
9947797
b1e14b8
8ed1d27
8e79e4a
56c9791
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from django.urls import path | ||
|
||
from . import views | ||
from .views import UploadImageView | ||
|
||
urlpatterns = [ | ||
path("image_upload/", views.upload_file, name="ck_editor_5_upload_file"), | ||
path("image_upload/", UploadImageView.as_view(), name="ck_editor_5_upload_image"), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from django.test import override_settings | ||
from django.urls import reverse | ||
|
||
|
||
def test_upload_file(admin_client, file): | ||
with file as upload: | ||
response = admin_client.post( | ||
reverse("ck_editor_5_upload_image"), | ||
{"upload": upload}, | ||
) | ||
assert response.status_code == 200 | ||
assert "url" in response.json() | ||
|
||
|
||
@override_settings( | ||
CKEDITOR_5_FILE_STORAGE="storages.backends.gcloud.GoogleCloudStorage", | ||
GS_BUCKET_NAME="test", | ||
) | ||
def test_upload_file_to_google_cloud(admin_client, file, settings): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test is oddly now failing for me but I think that's because it was not actually using |
||
with file as upload: | ||
response = admin_client.post( | ||
reverse("ck_editor_5_upload_image"), | ||
{"upload": upload}, | ||
) | ||
assert response.status_code == 200 | ||
assert "url" in response.json() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a potentially breaking change if anyone uses
reverse("ck_editor_5_upload_file")
(I do :) ). Is this renaming fromfile
toimage
really necessary? If it is it should be marked as a breaking change somehow, there currently is no changelog but we probably should introduce one at some point. What do you think @hvlads ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@goapunk Well i decided to rename to image to be more semantic, considering the endpoint only allow upload images. Maybe is a good idea an this point create the changelog file and at least include the improvements in the next release, maybe the info: