def test_factory_can_create_many_to_many(self):
        with self.subTest('Can add authors to the factory'):
            author = factories.AuthorFactory()
            entry = factories.EntryFactory(
                authors=(author,)
            )
            self.assertEqual(1, entry.authors.count())

        with self.subTest('Traits can simplify greatly some usage'):
            entry = factories.EntryFactory(
                with_authors=True
            )
            self.assertTrue(entry.authors.exists())
Esempio n. 2
0
 def get(self, **kwargs):
     return factories.AuthorFactory(**kwargs)
Esempio n. 3
0
def author():
    return factories.AuthorFactory()