Example #1
0
def populate():
    ProfileFactory.create_batch(size=10)
    PostFactory.create_batch(size=4)
    PostImageFactory.create_batch(size=16)
    PaperFactory.create_batch(size=10)

    for p in Post.objects.all():
        print(p)
    print("...population finished")
Example #2
0
    def test_profile(self):
        ProfileFactory.create_batch(size=10)
        test_profile = ProfileFactory.create(first_name='Peter', last_name='File', is_active=True,
                                             homepage='http://www.test.com', affiliation='Reynholm Industries')

        self.assertTrue(isinstance(test_profile, Profile))
        self.assertEqual(test_profile.first_name, 'Peter')
        self.assertEqual(test_profile.last_name, 'File')
        self.assertTrue(test_profile.is_active)
        self.assertTrue(test_profile.check_password('password'))
        self.assertEqual(test_profile.homepage, 'http://www.test.com')
        self.assertEqual(test_profile.affiliation, 'Reynholm Industries')