from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.test import TestCase
import factory
from faker import Faker

from imager_profile.models import ImagerProfile
from .models import Album, Photo

# Create your tests here.
fake = Faker()


class UserFactory(factory.django.DjangoModelFactory):
    """Create a fake user."""
    class Meta:
        model = User

    username = factory.Sequence(lambda n: 'user{}'.format(n))
    first_name = fake.first_name()
    last_name = fake.last_name()
    email = fake.email()


class PhotoFactory(factory.django.DjangoModelFactory):
    """Create a fake photo."""
    class Meta:
        model = Photo

    photo = factory.django.ImageField()
    title = fake.sentence()
    description = fake.text()


class AlbumFactory(factory.django.DjangoModelFactory):
    """Create a fake album."""
    class Meta:
        model = Album

    title = fake.sentence()
    description = fake.text()


@@ -154,56 +154,8 @@
 er%0A%0A
-from imager_profile.models import ImagerProfile%0A
 from
@@ -729,16 +729,59 @@
 .text()%0A
+    user = factory.SubFactory(UserFactory)%0A
 %0A%0Aclass 
@@ -957,9 +957,253 @@
 .text()%0A
+    user = factory.SubFactory(UserFactory)%0A%0A%0Aclass PhotoTestCase(TestCase):%0A    %22%22%22docstring for PhotoTestCase%22%22%22%0A    @classmethod%0A    def setUp(cls):%0A        user = UserFactory()%0A        user.set_password('secret')%0A        user.save()%0A        
 %0A

Fix user, album factories; add setup for photo test case