Showing 2 of 2 files from the diff.

@@ -151,3 +151,12 @@
Loading
151 151
    page_2 = MyTestPageGetOrCreateFactory(slug="foobar", parent=root_page)
152 152
153 153
    assert page_1.pk == page_2.pk
154 +
155 +
156 +
@pytest.mark.django_db
157 +
def test_document_add_to_collection():
158 +
    root_collection = wagtail_factories.CollectionFactory(parent=None)
159 +
    document = wagtail_factories.DocumentFactory(
160 +
        collection__parent=root_collection, collection__name="new"
161 +
    )
162 +
    assert document.collection.name == "new"

@@ -8,12 +8,13 @@
Loading
8 8
try:
9 9
    from wagtail.wagtailcore.models import Collection, Page, Site
10 10
    from wagtail.wagtailimages import get_image_model
11 +
    from wagtail.wagtaildocs import get_document_model
11 12
except ImportError:
12 13
    from wagtail.core.models import Collection, Page, Site
13 14
    from wagtail.images import get_image_model
15 +
    from wagtail.documents.models import get_document_model
14 16
15 -
__all__ = ["CollectionFactory", "ImageFactory", "PageFactory", "SiteFactory"]
16 -
17 +
__all__ = ["CollectionFactory", "ImageFactory", "PageFactory", "SiteFactory", "DocumentFactory"]
17 18
logger = logging.getLogger(__file__)
18 19
19 20
@@ -136,3 +137,10 @@
Loading
136 137
137 138
    class Meta:
138 139
        model = Site
140 +
141 +
142 +
class DocumentFactory(CollectionMemberFactory):
143 +
    class Meta:
144 +
        model = get_document_model()
145 +
    title = "An document"
146 +
    file = factory.django.FileField()
Files Coverage
src/wagtail_factories 95.51%
tests 99.52%
Project Totals (12 files) 97.67%
Notifications are pending CI completion. Waiting for GitHub's status webhook to queue notifications. Push notifications now.
84.1
TRAVIS_PYTHON_VERSION=3.5
TRAVIS_OS_NAME=linux
TOXENV=py35-django111-wagtail230
84.5
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=py36-django210-wagtail230
84.3
TRAVIS_PYTHON_VERSION=3.5
TRAVIS_OS_NAME=linux
TOXENV=py35-django220-wagtail250
84.4
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=py36-django111-wagtail230
84.6
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=py36-django220-wagtail250
84.7
TRAVIS_PYTHON_VERSION=3.7
TRAVIS_OS_NAME=linux
TOXENV=py37-django111-wagtail230
84.9
TRAVIS_PYTHON_VERSION=3.7
TRAVIS_OS_NAME=linux
TOXENV=py37-django220-wagtail250

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading