예제 #1
0
 def setUp(self):
     """Setup for PhotoTests."""
     settings.MEDIA_ROOT = tempfile.mkdtemp()
     self.client = Client()
     someuser = User(username='******', password='******')
     self.someuser = someuser
     someuser.save()
     some_pro = someuser.profile
     self.some_pro = some_pro
     some_pro.save()
     album = Album(user=some_pro, title='Some Title')
     album.cover = Sup(name='bad_photo.jpg',
                       content=open('media/images/louie.png', 'rb').read(),
                       content_type='image/png')
     album.save()
     for i in range(10):
         photo = PhotoFactory.build()
         photo.user = some_pro
         photo.imgfile = Sup(name='bad_photo.jpg',
                             content=open('media/images/louie.png',
                                          'rb').read(),
                             content_type='image/png')
         photo.save()
         album.photo.add(photo)
     self.album = album
예제 #2
0
 def setUp(self):
     """50 users in database last one has profile."""
     user = User(password='******',
                 username='******',
                 email='*****@*****.**')
     user.save()
     user.profile.location = 'Seattle'
     user.profile.website = 'example.com'
     user.profile.fee = 0.0
     user.profile.phone = None
     user.profile.camera = 'NK'
     user.profile.services = 'P'
     user.profile.photo_styles = 'O'
     user.profile.save()
예제 #3
0
    def setUp(self):
        """Setup user, album, and photo instances for testing"""
        super(TestCase, self)

        user = User(username='******', email='*****@*****.**')
        user.save()
        self.user = user
        self.client = Client()

        photo = PhotoFactory.build()
        photo.user_id = self.user.id
        photo.save()
        self.photo = photo

        self.request = RequestFactory()
예제 #4
0
 def setUp(self):
     """Setup"""
     larry = User(username='******', password='******')
     larry.save()
     l_profile = larry.profile
     l_profile.location = "Denver"
     l_profile.save()
     album = Album(user=l_profile, title='Denver City')
     album.save()
     for i in range(20):
         photo = PhotoFactory.build()
         photo.user = l_profile
         photo.save()
         album.photos.add(photo)
     self.album = album
예제 #5
0
 def setUp(self):
     """Setup."""
     roberto = User(username='******', password='******')
     roberto.save()
     r_profile = roberto.profile
     r_profile.location = "Buffalo"
     r_profile.save()
     album = Album(user=User.objects.get(username='******'),
                   title='The Album')
     album.save()
     for i in range(30):
         photo = PhotoFactory.build()
         photo.user = User.objects.get(username='******')
         photo.save()
         album.photo.add(photo)
     self.album = album
예제 #6
0
 def setUp(self):
     """Setup."""
     for i in range(30):
         self.user = UserFactory.create()
         self.user.save()
         profile = self.user.profile
         profile.location = 'Anywhere but here'
         profile.save()
     unique_user = User(username='******', password='******')
     unique_user.save()
     profile = unique_user.profile
     profile.location = 'Seattle'
     profile.camera = 'FL'
     profile.service = 'PT'
     profile.photo_style = 'NT'
     profile.save()
예제 #7
0
    def setUp(self):
        user = User(username='******', email='*****@*****.**')
        user.save()
        self.user = user
        self.client = Client()

        photo = PhotoFactory.build()
        photo.user_id = self.user.id
        photo.save()
        self.photo = photo

        album = AlbumFactory.build()
        album.user_id = self.user.id
        album.save()
        self.album = album

        self.request = RequestFactory()
예제 #8
0
 def setUp(self):
     """Setup."""
     jimbo = User(username='******',
                  password='******')
     jimbo.save()
     j_profile = jimbo.profile
     j_profile.location = "Buffalo"
     j_profile.save()
     album = Album(user=j_profile, title='The Album')
     album.save()
     for i in range(30):
         photo = PhotoFactory.build()
         photo.user = j_profile
         # photo = Photo(user=j_profile, title=f'Pic{i}')
         photo.save()
         album.photos.add(photo)
     self.album = album
예제 #9
0
    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
예제 #10
0
    def setUp(self):
        """50 users in database last one has profile."""
        image = SimpleUploadedFile(
            name='example.jpg',
            content=open(os.path.join(BASE_DIR,
                                      'static/imagersite',
                                      'photo.jpg'), 'rb').read(),
            content_type='image/jpeg')

        user = User(password='******', username='******')
        user.save()
        user.profile.location = 'Seattle'
        user.profile.website = 'example.com'
        user.profile.fee = 0.0
        user.profile.phone = None
        user.profile.camera = 'NK'
        user.profile.services = 'P'
        user.profile.photo_styles = 'O'
        user.profile.save()

        photo = Photo(user=user.profile,
                      image=image,
                      title='photo title',
                      description='description of photo',
                      date_published='1994-10-12',
                      published='PU')
        photo.save()

        album = Album(user=user.profile,
                      title='album title',
                      description='description of album',
                      date_published='1994-10-12',
                      published='PU')
        album.save()
        album.photo.add(photo)
        album.save()
예제 #11
0
    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()