Skip to content

Commit

Permalink
✅ Add test for document collection pagination behavious
Browse files Browse the repository at this point in the history
  • Loading branch information
pajowu committed Oct 26, 2022
1 parent fe7db42 commit 78d8c21
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import factory

from filingcabinet import get_document_model, get_documentcollection_model
from filingcabinet.models import CollectionDirectory

Document = get_document_model()
DocumentCollection = get_documentcollection_model()
Expand All @@ -13,6 +14,8 @@ class UserFactory(factory.django.DjangoModelFactory):
class Meta:
model = settings.AUTH_USER_MODEL

username = factory.Sequence(lambda n: "user_%s" % n)


class DocumentFactory(factory.django.DjangoModelFactory):
class Meta:
Expand All @@ -29,3 +32,15 @@ class Meta:
title = factory.Sequence(lambda n: "DocumentCollection {}".format(n))
slug = factory.LazyAttribute(lambda o: slugify(o.title))
user = factory.SubFactory(UserFactory)


class CollectionDirectoryFactory(factory.django.DjangoModelFactory):
class Meta:
model = CollectionDirectory

user = factory.SubFactory(UserFactory)
collection = factory.SubFactory(
DocumentCollectionFactory, user=factory.SelfAttribute("..user")
)
depth = 1
name = factory.Sequence(lambda n: "Document collection %s" % n)

0 comments on commit 78d8c21

Please sign in to comment.