mirror of
https://github.com/boostorg/website-v2.git
synced 2026-01-19 04:42:17 +00:00
- Add RenderedContent model and related helper methods - Change StaticContentView `get()` logic to try the cache, then the db, then S3 - Change StaticContentView to update db appropriately - Refactoring for readability/maintainability
28 lines
645 B
Python
28 lines
645 B
Python
import pytest
|
|
import tempfile
|
|
from PIL import Image
|
|
|
|
from django.core.files import File as DjangoFile
|
|
|
|
# Include the various pytest fixtures from all of our Django apps tests
|
|
# directories
|
|
pytest_plugins = [
|
|
"core.tests.fixtures",
|
|
"libraries.tests.fixtures",
|
|
"news.tests.fixtures",
|
|
"users.tests.fixtures",
|
|
"versions.tests.fixtures",
|
|
]
|
|
|
|
|
|
@pytest.fixture
|
|
def temp_image_file():
|
|
image = Image.new("RGB", (100, 100))
|
|
|
|
tmp_file = tempfile.NamedTemporaryFile(suffix=".jpg")
|
|
image.save(tmp_file)
|
|
|
|
tmp_file.seek(0)
|
|
file_obj = DjangoFile(open(tmp_file.name, mode="rb"), name="tmp_file")
|
|
yield file_obj.seek(0)
|