コード例 #1
0
ファイル: tests.py プロジェクト: jnns/pytest-django-factories
def test_factory_repr():
    assert repr(Factory(Author)) == "Factory(Author)"
    assert repr(Factory(Author, name="foo")) == "Factory(Author, name='foo')"
コード例 #2
0
def chapter_factory(request):
    return Factory(Chapter)(request)
コード例 #3
0
def model_b_factory(request):
    """Please note that a factory function for ModelA is missing intentionally."""
    return Factory(ModelB)(request)
コード例 #4
0
def broken_factory(request):
    return Factory(Book, author=SubFactory("bill_watterson"))(request)
コード例 #5
0
def watterson_book_factory(request, watterson_author_factory):
    """This factory builds objects with "Bill Watterson" as default author."""
    return Factory(Book,
                   author=SubFactory("watterson_author_factory"))(request)
コード例 #6
0
def watterson_author_factory(request):
    return Factory(Author, name="Bill Watterson")(request)
コード例 #7
0
def book_factory(request):
    return Factory(Book, title="Default Title")(request)
コード例 #8
0
def author_factory(request):
    factory = Factory(Author, name="Default Author")
    return factory(request)