Gab's Notes backend https://gabnotes.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

20 lines
677 B

from pathlib import Path
import pytest
from django.core.files import File
from attachments.models import Attachment
@pytest.mark.block_network()
@pytest.mark.vcr()
@pytest.mark.django_db()
def test_attachment_is_processed_by_shortpixel():
# This path manipulation is required to make the test run from this directory
# or from upper in the hierarchy (e.g.: settings.BASE_DIR)
img_path = Path(__file__).parent / "resources" / "image.png"
img_path = img_path.relative_to(Path.cwd())
with open(img_path, "rb") as f:
img_file = File(f)
attachment = Attachment(description="test attachment", original_file=img_file)
attachment.save()