mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 12:29:24 +00:00
Serve upload files directly from nginx
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
from io import BytesIO
|
||||
from itertools import cycle
|
||||
from pathlib import Path
|
||||
from typing import Callable
|
||||
from uuid import uuid4
|
||||
|
||||
@ -291,6 +292,15 @@ def test_apply_rights_recursively():
|
||||
),
|
||||
200,
|
||||
),
|
||||
(
|
||||
lambda: old_subscriber_user.make(),
|
||||
SimpleUploadedFile(
|
||||
"ttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestesttesttesttesttesttesttesttesttesttesttesttest.jpg",
|
||||
content=RED_PIXEL_PNG,
|
||||
content_type="image/jpg",
|
||||
),
|
||||
200,
|
||||
), # very long file name
|
||||
(
|
||||
lambda: old_subscriber_user.make(),
|
||||
SimpleUploadedFile(
|
||||
@ -329,4 +339,8 @@ def test_quick_upload_image(
|
||||
if expected_status != 200:
|
||||
return
|
||||
|
||||
assert QuickUploadImage.objects.filter(pk=resp.json()["uuid"]).exists()
|
||||
parsed = resp.json()
|
||||
assert QuickUploadImage.objects.filter(uuid=parsed["uuid"]).exists()
|
||||
assert (
|
||||
parsed["name"] == Path(file.name).stem[: QuickUploadImage.IMAGE_NAME_SIZE - 1]
|
||||
)
|
||||
|
Reference in New Issue
Block a user