Example #1
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.video1 = self.create_video(name='Video1')
     self.video2 = self.create_video(name='Video2')
     self.video3 = self.create_video(name='Video3')
     self.video4 = self.create_video(name='Video4')
Example #2
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     Site.objects.create(name='example.com', domain='example.com')
     self.user_filter = utils.ModelFilter(('authors', 'user'), User)
     self.category_filter = utils.ModelFilter(('categories',), Category,
                                              field='slug')
     self.user1 = self.create_user(username='******')
     self.user2 = self.create_user(username='******')
     self.category1 = self.create_category(name='category1')
     self.category2 = self.create_category(name='category2')
     self.category3 = self.create_category(name='category3', site_id=2)
     self.video1 = self.create_video(name='user1,category1', user=self.user1,
                                     categories=[self.category1])
     self.video2 = self.create_video(name='user1,category2',
                                     authors=[self.user1],
                                     categories=[self.category2])
     self.video3 = self.create_video(name='user2,category1',
                                     authors=[self.user2],
                                     categories=[self.category1])
     self.video4 = self.create_video(name='user2,category2', user=self.user2,
                                     categories=[self.category2])
     self.video5 = self.create_video(name='user1-2,category1-2',
                                     authors=[self.user1, self.user2],
                                     categories=[self.category1,
                                                 self.category2])
     self.video6 = self.create_video(name='category3',
                                     categories=[self.category3])
Example #3
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     Site.objects.create(name='example.com', domain='example.com')
     self.user_field = forms.SearchForm.base_fields['author']
     self.category_field = forms.SearchForm.base_fields['category']
     self.user1 = self.create_user(username='******')
     self.user2 = self.create_user(username='******')
     self.category1 = self.create_category(name='category1')
     self.category2 = self.create_category(name='category2')
     self.category3 = self.create_category(name='category3', site_id=2)
     self.video1 = self.create_video(name='user1,category1',
                                     user=self.user1,
                                     categories=[self.category1])
     self.video2 = self.create_video(name='user1,category2',
                                     authors=[self.user1],
                                     categories=[self.category2])
     self.video3 = self.create_video(name='user2,category1',
                                     authors=[self.user2],
                                     categories=[self.category1])
     self.video4 = self.create_video(name='user2,category2',
                                     user=self.user2,
                                     categories=[self.category2])
     self.video5 = self.create_video(
         name='user1-2,category1-2',
         authors=[self.user1, self.user2],
         categories=[self.category1, self.category2])
     self.video6 = self.create_video(name='category3',
                                     categories=[self.category3])
Example #4
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.video1 = self.create_video(name='Video1')
     self.video2 = self.create_video(name='Video2')
     self.video3 = self.create_video(name='Video3')
     self.video4 = self.create_video(name='Video4')
Example #5
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     Site.objects.create(name='example.com', domain='example.com')
     self.user_field = forms.SearchForm.base_fields['author']
     self.category_field = forms.SearchForm.base_fields['category']
     self.user1 = self.create_user(username='******')
     self.user2 = self.create_user(username='******')
     self.category1 = self.create_category(name='category1')
     self.category2 = self.create_category(name='category2')
     self.category3 = self.create_category(name='category3', site_id=2)
     self.video1 = self.create_video(name='user1,category1', user=self.user1,
                                     categories=[self.category1])
     self.video2 = self.create_video(name='user1,category2',
                                     authors=[self.user1],
                                     categories=[self.category2])
     self.video3 = self.create_video(name='user2,category1',
                                     authors=[self.user2],
                                     categories=[self.category1])
     self.video4 = self.create_video(name='user2,category2', user=self.user2,
                                     categories=[self.category2])
     self.video5 = self.create_video(name='user1-2,category1-2',
                                     authors=[self.user1, self.user2],
                                     categories=[self.category1,
                                                 self.category2])
     self.video6 = self.create_video(name='category3',
                                     categories=[self.category3])
Example #6
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     Site.objects.create(name='example.com', domain='example.com')
     self.user_filter = utils.ModelFilter(('authors', 'user'), User)
     self.category_filter = utils.ModelFilter(('categories', ),
                                              Category,
                                              field='slug')
     self.user1 = self.create_user(username='******')
     self.user2 = self.create_user(username='******')
     self.category1 = self.create_category(name='category1')
     self.category2 = self.create_category(name='category2')
     self.category3 = self.create_category(name='category3', site_id=2)
     self.video1 = self.create_video(name='user1,category1',
                                     user=self.user1,
                                     categories=[self.category1])
     self.video2 = self.create_video(name='user1,category2',
                                     authors=[self.user1],
                                     categories=[self.category2])
     self.video3 = self.create_video(name='user2,category1',
                                     authors=[self.user2],
                                     categories=[self.category1])
     self.video4 = self.create_video(name='user2,category2',
                                     user=self.user2,
                                     categories=[self.category2])
     self.video5 = self.create_video(
         name='user1-2,category1-2',
         authors=[self.user1, self.user2],
         categories=[self.category1, self.category2])
     self.video6 = self.create_video(name='category3',
                                     categories=[self.category3])
 def setUp(self):
     BaseTestCase.setUp(self)
     url = reverse('localtv_submit_video')
     self.site_settings = SiteSettings.objects.get()
     self.anonymous_request = self.factory.get(url)
     self.user_request = self.factory.get(
         url, user=User.objects.get(username='******'))
     self.admin_request = self.factory.get(
         url, user=User.objects.get(username='******'))
Example #8
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.video0 = self.create_video(name='Unapproved',
                                     status=Video.UNAPPROVED,
                                     update_index=False)
     self.video1 = self.create_video(name='Video1', update_index=False)
     self.video2 = self.create_video(name='Video2', update_index=False)
     self.video3 = self.create_video(name='Video3', update_index=False)
     self.video4 = self.create_video(name='Video4', update_index=False)
Example #9
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.video0 = self.create_video(name='Unapproved',
                                     status=Video.UNAPPROVED,
                                     update_index=False)
     self.video1 = self.create_video(name='Video1', update_index=False)
     self.video2 = self.create_video(name='Video2', update_index=False)
     self.video3 = self.create_video(name='Video3', update_index=False)
     self.video4 = self.create_video(name='Video4', update_index=False)
Example #10
0
 def setUp(self):
     BaseTestCase.setUp(self)
     SiteSettings.objects.create(site_id=1)
     self.feed = Feed.objects.create(name='Feed', site_id=1,
                                     last_updated=datetime.datetime.now())
     self.unapproved_video = self.create_video('Feed Video',
                                               status=Video.UNAPPROVED,
                                               feed=self.feed)
     self.unapproved_user_video = self.create_video('User Video',
                                                    status=Video.UNAPPROVED)
Example #11
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.create_video()
     self.create_video()
     self.create_video(status=Video.UNAPPROVED)
     self.nvl1 = utils.NormalizedVideoList(
         Video.objects.filter(status=Video.ACTIVE))
     sqs = SearchQuerySet().models(Video)
     sqs = sqs.filter(utils._exact_q(sqs, 'site', 1))
     self.nvl2 = utils.NormalizedVideoList(sqs)
Example #12
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.create_video()
     self.create_video()
     self.create_video(status=Video.UNAPPROVED)
     self.nvl1 = utils.NormalizedVideoList(
                         Video.objects.filter(status=Video.ACTIVE))
     sqs = SearchQuerySet().models(Video)
     sqs = sqs.filter(utils._exact_q(sqs, 'site', 1))
     self.nvl2 = utils.NormalizedVideoList(sqs)
Example #13
0
 def setUp(self):
     BaseTestCase.setUp(self)
     SiteLocation.objects.create(site_id=1)
     self.feed = Feed.objects.create(name='Feed',
                                     site_id=1,
                                     last_updated=datetime.datetime.now())
     self.unapproved_video = self.create_video('Feed Video',
                                               status=Video.UNAPPROVED,
                                               feed=self.feed)
     self.unapproved_user_video = self.create_video('User Video',
                                                    status=Video.UNAPPROVED)
Example #14
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.video0 = self.create_video(name="0 watches", watches=0)
     self.video2 = self.create_video(name="3 watches", watches=3)
     self.video1 = self.create_video(name="1 watch", watches=1)
     self.video3 = self.create_video(name="4 watches", watches=4)
     self.video4 = self.create_video(name="2 watches (5 total)", watches=2)
     for i in xrange(14, 17):
         self.create_watch(self.video4, days=i)
     self.sort = utils.PopularSort()
Example #15
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.video0 = self.create_video(name="0 watches", watches=0)
     self.video2 = self.create_video(name="3 watches", watches=3)
     self.video1 = self.create_video(name="1 watch", watches=1)
     self.video3 = self.create_video(name="4 watches", watches=4)
     self.video4 = self.create_video(name="2 watches (5 total)", watches=2)
     for i in xrange(14, 17):
         self.create_watch(self.video4, days=i)
     self.sort = utils.PopularSort()
Example #16
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.create_video()
     self.create_video()
     self.create_video(status=Video.UNAPPROVED)
     self.nvl1 = utils.NormalizedVideoList(
                         Video.objects.filter(status=Video.ACTIVE))
     sqs = SearchQuerySet().models(Video)
     if 'WhooshEngine' in connections['default'].options['ENGINE']:
         sqs = sqs.filter(site=1)
     else:
         sqs = sqs.filter(site__exact=1)
     self.nvl2 = utils.NormalizedVideoList(sqs)
Example #17
0
 def setUp(self):
     BaseTestCase.setUp(self)
     SiteLocation.objects.create(site_id=1)
     self._clear_index()
     now = datetime.datetime.now()
     yesterday = datetime.datetime.now() - datetime.timedelta(days=1)
     self.test_video = self.create_video(when_submitted=now,
                                         when_approved=now,
                                         when_published=now)
     self.yesterday_video = self.create_video(name='Foo Foo',
                                              when_submitted=yesterday,
                                              when_approved=yesterday,
                                              when_published=yesterday)
     self.unapproved_video = self.create_video(status=Video.UNAPPROVED)
Example #18
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.create_video()
     self.create_video()
     self.create_video(status=Video.UNAPPROVED)
     self.nvl1 = utils.NormalizedVideoList(
         Video.objects.filter(status=Video.ACTIVE))
     sqs = SearchQuerySet().models(Video)
     if 'WhooshEngine' in connections['default'].options['ENGINE']:
         sqs = sqs.filter(site=1)
     else:
         sqs = sqs.filter(site__exact=1)
     self.nvl2 = utils.NormalizedVideoList(sqs)
Example #19
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     date1 = datetime.now() - timedelta(7)
     date2 = datetime.now()
     date3 = datetime.now() - timedelta(3)
     f = "%Y/%m/%d"
     self.video1 = self.create_video(name=date1.strftime(f),
                                     last_featured=date1)
     self.video2 = self.create_video(name=date2.strftime(f),
                                     last_featured=date2)
     self.video3 = self.create_video(name=date3.strftime(f),
                                     last_featured=date3)
     self.video4 = self.create_video(name='None', last_featured=None)
     self.sort = utils.Sort('Featured', 'last_featured')
Example #20
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     date1 = datetime.now() - timedelta(7)
     date2 = datetime.now()
     date3 = datetime.now() - timedelta(3)
     f = "%Y/%m/%d"
     self.video1 = self.create_video(name=date1.strftime(f),
                                     when_approved=date1)
     self.video2 = self.create_video(name=date2.strftime(f),
                                     when_approved=date2)
     self.video3 = self.create_video(name=date3.strftime(f),
                                     when_approved=date3)
     self.video4 = self.create_video(name='None', when_approved=None)
     self.sort = utils.ApprovedSort()
Example #21
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     date1 = datetime.now() - timedelta(7)
     date2 = datetime.now()
     date3 = datetime.now() - timedelta(3)
     f = "%Y/%m/%d"
     self.video1 = self.create_video(name=date1.strftime(f),
                                     last_featured=date1)
     self.video2 = self.create_video(name=date2.strftime(f),
                                     last_featured=date2)
     self.video3 = self.create_video(name=date3.strftime(f),
                                     last_featured=date3)
     self.video4 = self.create_video(name='None', last_featured=None)
     self.sort = utils.Sort('Featured', 'last_featured')
Example #22
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     date1 = datetime.now() - timedelta(7)
     date2 = datetime.now()
     date3 = datetime.now() - timedelta(3)
     f = "%Y/%m/%d"
     self.video1 = self.create_video(name=date1.strftime(f),
                                     when_approved=date1)
     self.video2 = self.create_video(name=date2.strftime(f),
                                     when_approved=date2)
     self.video3 = self.create_video(name=date3.strftime(f),
                                     when_approved=date3)
     self.video4 = self.create_video(name='None', when_approved=None)
     self.sort = utils.ApprovedSort()
Example #23
0
    def setUp(self):
        BaseTestCase.setUp(self)
        self.user = self.create_user(username='******', password='******')
        self.list = Playlist.objects.create(
            site_id=settings.SITE_ID,
            user=self.user,
            name='Test List',
            slug='test-list',
            description="This is a list for testing")

        self.video_set = [self.create_video() for i in range(3)]

        for index, video in enumerate(self.video_set[::-1]):  # reverse order
            PlaylistItem.objects.create(playlist=self.list,
                                        video=video,
                                        _order=index)
Example #24
0
 def setUp(self):
     BaseTestCase.setUp(self)
     SiteSettings.objects.create(site_id=1)
     self._clear_index()
     now = datetime.datetime.now()
     yesterday = datetime.datetime.now() - datetime.timedelta(days=1)
     self.test_video = self.create_video(
         when_submitted=now,
         when_approved=now,
         when_published=now)
     self.yesterday_video = self.create_video(
         name='Foo Foo',
         when_submitted=yesterday,
         when_approved=yesterday,
         when_published=yesterday)
     self.unapproved_video = self.create_video(status=Video.UNAPPROVED)
Example #25
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.filter = utils.TagFilter(('tags',))
     self.site2 = Site.objects.create(name='example.com', domain='example.com')
     self.tag1 = self.create_tag(name='tag1')
     self.tag2 = self.create_tag(name='tag2')
     self.tag3 = self.create_tag(name='tag3')
     self.tag4 = self.create_tag(name='tag4')
     self.tag5 = self.create_tag(name='tag5')
     self.video1 = self.create_video(name='tags1-2', tags='tag1 tag2')
     self.video2 = self.create_video(name='tags1-3', tags='tag1 tag3')
     self.video3 = self.create_video(name='tags1-2-3', tags='tag1 tag2 tag3')
     self.video4 = self.create_video(name='tag3', tags='tag3')
     self.video5 = self.create_video(name='tag4', tags='tag4',
                                     status=Video.UNAPPROVED)
     self.video6 = self.create_video(name='tag4_2', tags='tag4', site_id=2)
Example #26
0
    def setUp(self):
        BaseTestCase.setUp(self)
        self.user = self.create_user(username='******', password='******')
        self.list = Playlist.objects.create(
            site_id=settings.SITE_ID,
            user=self.user,
            name='Test List',
            slug='test-list',
            description="This is a list for testing")

        self.video_set = [self.create_video() for i in range(3)]

        for index, video in enumerate(self.video_set[::-1]): # reverse order
            PlaylistItem.objects.create(
                playlist=self.list,
                video=video,
                _order=index)
Example #27
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.field = forms.SearchForm.base_fields['tag']
     self.site2 = Site.objects.create(name='example.com', domain='example.com')
     self.tag1 = self.create_tag(name='tag1')
     self.tag2 = self.create_tag(name='tag2')
     self.tag3 = self.create_tag(name='tag3')
     self.tag4 = self.create_tag(name='tag4')
     self.tag5 = self.create_tag(name='tag5')
     self.video1 = self.create_video(name='tags1-2', tags='tag1 tag2')
     self.video2 = self.create_video(name='tags1-3', tags='tag1 tag3')
     self.video3 = self.create_video(name='tags1-2-3', tags='tag1 tag2 tag3')
     self.video4 = self.create_video(name='tag3', tags='tag3')
     self.video5 = self.create_video(name='tag4', tags='tag4',
                                     status=Video.UNAPPROVED)
     self.video6 = self.create_video(name='tag4_2', tags='tag4', site_id=2)
Example #28
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.field = forms.SearchForm.base_fields['tag']
     self.site2 = Site.objects.create(name='example.com',
                                      domain='example.com')
     self.tag1 = self.create_tag(name='tag1')
     self.tag2 = self.create_tag(name='tag2')
     self.tag3 = self.create_tag(name='tag3')
     self.tag4 = self.create_tag(name='tag4')
     self.tag5 = self.create_tag(name='tag5')
     self.video1 = self.create_video(name='tags1-2', tags='tag1 tag2')
     self.video2 = self.create_video(name='tags1-3', tags='tag1 tag3')
     self.video3 = self.create_video(name='tags1-2-3',
                                     tags='tag1 tag2 tag3')
     self.video4 = self.create_video(name='tag3', tags='tag3')
     self.video5 = self.create_video(name='tag4',
                                     tags='tag4',
                                     status=Video.UNAPPROVED)
     self.video6 = self.create_video(name='tag4_2', tags='tag4', site_id=2)
Example #29
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     self.filter = utils.TagFilter(('tags', ))
     self.site2 = Site.objects.create(name='example.com',
                                      domain='example.com')
     self.tag1 = self.create_tag(name='tag1')
     self.tag2 = self.create_tag(name='tag2')
     self.tag3 = self.create_tag(name='tag3')
     self.tag4 = self.create_tag(name='tag4')
     self.tag5 = self.create_tag(name='tag5')
     self.video1 = self.create_video(name='tags1-2', tags='tag1 tag2')
     self.video2 = self.create_video(name='tags1-3', tags='tag1 tag3')
     self.video3 = self.create_video(name='tags1-2-3',
                                     tags='tag1 tag2 tag3')
     self.video4 = self.create_video(name='tag3', tags='tag3')
     self.video5 = self.create_video(name='tag4',
                                     tags='tag4',
                                     status=Video.UNAPPROVED)
     self.video6 = self.create_video(name='tag4_2', tags='tag4', site_id=2)
Example #30
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     date1_1 = datetime.now() - timedelta(7)
     date1_2 = datetime.now() - timedelta(1)
     date2 = datetime.now()
     date3 = datetime.now() - timedelta(3)
     f = "%Y/%m/%d"
     self.video1 = self.create_video(
         name="%s - %s" % (date1_1.strftime(f), date1_2.strftime(f)),
         when_approved=date1_1,
         when_published=date1_2)
     self.video2 = self.create_video(name="%s - %s" %
                                     (date2.strftime(f), date2.strftime(f)),
                                     when_approved=date2,
                                     when_published=date2)
     self.video3 = self.create_video(name="%s - %s" %
                                     (date3.strftime(f), date3.strftime(f)),
                                     when_approved=date3,
                                     when_published=date3)
     self.site_settings = SiteSettings.objects.get_current()
Example #31
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self._clear_index()
     date1_1 = datetime.now() - timedelta(7)
     date1_2 = datetime.now() - timedelta(1)
     date2 = datetime.now()
     date3 = datetime.now() - timedelta(3)
     f = "%Y/%m/%d"
     self.video1 = self.create_video(name="%s - %s" % (date1_1.strftime(f),
                                                       date1_2.strftime(f)),
                                     when_approved=date1_1,
                                     when_published=date1_2)
     self.video2 = self.create_video(name="%s - %s" % (date2.strftime(f),
                                                       date2.strftime(f)),
                                     when_approved=date2,
                                     when_published=date2)
     self.video3 = self.create_video(name="%s - %s" % (date3.strftime(f),
                                                       date3.strftime(f)),
                                     when_approved=date3,
                                     when_published=date3)
     self.site_settings = SiteSettings.objects.get_current()
Example #32
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self.index = connections['default'].get_unified_index().get_index(
                                                                     Video)
 def setUp(self):
     BaseTestCase.setUp(self)
     self.form_class = modelform_factory(Video,
                                         forms.ThumbnailSubmitVideoForm)
Example #34
0
 def setUp(self):
     BaseTestCase.setUp(self)
     self.index = connections['default'].get_unified_index().get_index(
         Video)
Example #35
0
	def setUp(self):
		BaseTestCase.setUp(self)
		self.assertIsInstance(SiteSettings.objects, SiteRelatedManager)