def setUp(self): """Setup.""" settings.MEDIA_ROOT = tempfile.mkdtemp() self.c = Client() jimbo = User(username='******') jimbo.set_password('p@ssw0rd') jimbo.save() jimbo.profile.location = "Buffalo" jimbo.profile.save() album = Album(user=jimbo.profile, title='The Album') album.cover = Sup(name='this_is_fine.png', content=open('media/images/this_is_fine.png', 'rb').read(), content_type='image/png') album.save() for i in range(30): photo = Photo(user=jimbo.profile, title=f'Pic{i}') photo.image = Sup(name='this_is_fine.png', content=open('media/images/this_is_fine.png', 'rb').read(), content_type='image/png') photo.save() album.photo.add(photo) self.user = jimbo self.album = album
def setUp(self): """Create a user for testing purposes.""" user = User(username='******', email='*****@*****.**') user.set_password('password') user.save() profile = ImagerProfile(website='www.pics4you.com', location='Seattle', fee=500, camera='Nikon Pro 3500', services='Weddings', bio='I will take picutres for any occasion.', phone='206-555-1212', photo_style='Matte Finish', user=user ) profile.save() user = UserFactory.create() user.set_password(factory.Faker('password')) user.save() profile = ProfileFactory.create(user=user, is_active=False) profile.save() for _ in range(10): user = UserFactory.create() user.set_password(factory.Faker('password')) user.save() profile = ProfileFactory.create(user=user) profile.save()