Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
srugano committed Jun 12, 2024
1 parent 6420d49 commit 631486b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/admin/test_admin_rt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

@pytest.fixture()
def report_template():
from testutils.factories import ReportTemplate
from testutils.factories import ReportTemplateFactory

return ReportTemplate.objects.first()
return ReportTemplateFactory()


@pytest.fixture()
Expand Down
10 changes: 8 additions & 2 deletions tests/extras/testutils/factories/power_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

from django.apps import apps
from django.core.files.base import ContentFile

from django.core.files.uploadedfile import SimpleUploadedFile
import factory
from strategy_field.utils import fqn

from hope_country_report.apps.power_query.models import (
ChartPage,
Dataset,
Expand Down Expand Up @@ -49,6 +48,13 @@ class Meta:
model = ReportTemplate
django_get_or_create = ("name",)

country_office = factory.SubFactory(CountryOfficeFactory)
name = factory.Faker("word")
file_suffix = ".pdf"
doc = factory.LazyAttribute(
lambda _: SimpleUploadedFile("test_template.pdf", b"Test file content", content_type="application/pdf")
)


class FormatterFactory(AutoRegisterModelFactory):
name = "Queryset To HTML"
Expand Down

0 comments on commit 631486b

Please sign in to comment.