Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit Vermeulen committed Feb 13, 2024
1 parent 8cda1b9 commit 3209906
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions home/tests/test_content_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

import pytest
from django.core import serializers # type: ignore
from django.core.files.base import File
from django.core.files.base import File # type: ignore
from django.core.files.images import ImageFile # type: ignore
from openpyxl import load_workbook
from pytest_django.fixtures import SettingsWrapper
from wagtail.images.models import Image # type: ignore
from wagtail.models import Locale, Page # type: ignore
from wagtailmedia.models import Media
from wagtailmedia.models import Media # type: ignore

from home.content_import_export import import_content
from home.import_content_pages import ImportException
Expand Down Expand Up @@ -912,6 +912,7 @@ def test_ContentPage_required_fields(self, csv_impexp: ImportExport) -> None:

assert src == dst


@pytest.mark.django_db
class TestExport:
"""
Expand All @@ -920,7 +921,8 @@ class TestExport:
NOTE: This is not a Django (or even unittest) TestCase. It's just a
container for related tests.
"""
def test_export_wa_with_image(self, impexp: ImportExport):

def test_export_wa_with_image(self, impexp: ImportExport) -> None:
img_path = Path("home/tests/test_static") / "test.jpeg"
img_wa = mk_img(img_path, "wa_image")

Expand All @@ -935,9 +937,10 @@ def test_export_wa_with_image(self, impexp: ImportExport):
],
)
content = impexp.export_content(locale="en")
assert True
# Export should succeed
assert content is not None

def test_export_viber_with_image(self, impexp: ImportExport):
def test_export_viber_with_image(self, impexp: ImportExport) -> None:
img_path = Path("home/tests/test_static") / "test.jpeg"
img_v = mk_img(img_path, "v_image")

Expand All @@ -952,9 +955,10 @@ def test_export_viber_with_image(self, impexp: ImportExport):
],
)
content = impexp.export_content(locale="en")
assert True
# Export should succeed
assert content is not None

def test_export_messenger_with_image(self, impexp: ImportExport):
def test_export_messenger_with_image(self, impexp: ImportExport) -> None:
img_path = Path("home/tests/test_static") / "test.jpeg"
img_m = mk_img(img_path, "m_image")

Expand All @@ -969,9 +973,10 @@ def test_export_messenger_with_image(self, impexp: ImportExport):
],
)
content = impexp.export_content(locale="en")
assert True
# Export should succeed
assert content is not None

def test_export_wa_with_media(self, impexp: ImportExport):
def test_export_wa_with_media(self, impexp: ImportExport) -> None:
media_path = Path("home/tests/test_static") / "test.mp4"
media_wa = mk_media(media_path, "wa_media")

Expand All @@ -986,7 +991,8 @@ def test_export_wa_with_media(self, impexp: ImportExport):
],
)
content = impexp.export_content(locale="en")
assert True
# Export should succeed
assert content is not None


@pytest.fixture(params=["csv", "xlsx"])
Expand All @@ -1004,6 +1010,7 @@ def mk_img(img_path: Path, title: str) -> Image:
img.save()
return img


def mk_media(media_path: Path, title: str) -> File:
media = Media(title=title, file=File(media_path.open("rb"), name=media_path.name))
media.save()
Expand Down

0 comments on commit 3209906

Please sign in to comment.