Ejemplo n.º 1
0
 def setup_class(cls):
     """
     Populate test data with searchable opinions so the dashboard/search
     results aren't empty (too few results will cause the tests to fail.
     """
     populate(100, 'desktop')
     super(TestDashboard, cls).setup_class()
Ejemplo n.º 2
0
 def setup_class(cls):
     """
     Populate test data with searchable opinions so the dashboard/search
     results aren't empty (too few results will cause the tests to fail.
     """
     populate(100, 'desktop')
     super(TestDashboard, cls).setup_class()
Ejemplo n.º 3
0
 def setup_class(cls):
     # add more opinions so we can test things.
     populate(21, 'desktop', OPINION_IDEA)
     populate(100, 'mobile', OPINION_IDEA)
     populate(5, 'desktop', OPINION_PRAISE)
     populate(10, 'desktop', OPINION_ISSUE)
     super(SearchViewTest, cls).setup_class()
Ejemplo n.º 4
0
    def test_forward_mobile(self, mock):
        fake_mobile_domain = 'mymobiledomain.example.com'

        populate(1)
        id = Opinion.objects.values_list('id', flat=True)[0]

        def side_effect(*args, **kwargs):
            class FakeSite(object):
                id = settings.MOBILE_SITE_ID
                domain = fake_mobile_domain
            return FakeSite()
        mock.side_effect = side_effect

        r = self.mclient.get(reverse('opinion.detail', args=[id]) +
                             '?foo=bar')
        eq_(r.status_code, 302)
        eq_(r['Location'], 'http://' + fake_mobile_domain +
            reverse('opinion.detail', args=[id]) + '?foo=bar')
Ejemplo n.º 5
0
    def test_forward_mobile(self, mock):
        fake_mobile_domain = 'mymobiledomain.example.com'

        populate(1)
        id = Opinion.objects.values_list('id', flat=True)[0]

        def side_effect(*args, **kwargs):
            class FakeSite(object):
                id = settings.MOBILE_SITE_ID
                domain = fake_mobile_domain

            return FakeSite()

        mock.side_effect = side_effect

        r = self.mclient.get(reverse('opinion.detail', args=[id]) + '?foo=bar')
        eq_(r.status_code, 302)
        eq_(
            r['Location'], 'http://' + fake_mobile_domain +
            reverse('opinion.detail', args=[id]) + '?foo=bar')
Ejemplo n.º 6
0
 def setup_class(cls):
     # add more opinions so we can test things.
     populate(1000, 'desktop', OPINION_IDEA)
     super(PaginationTest, cls).setup_class()
Ejemplo n.º 7
0
 def test_populate(self):
     populate()
     eq_(Opinion.objects.count(), DEFAULT_NUM_OPINIONS)
Ejemplo n.º 8
0
 def test_populate_rating(self):
     populate(DEFAULT_NUM_OPINIONS, 'desktop', input.OPINION_RATING)
     count = Opinion.objects.filter(
             type=input.OPINION_RATING.id).count()
     eq_(count, DEFAULT_NUM_OPINIONS)
Ejemplo n.º 9
0
 def test_populate_type(self):
     populate(DEFAULT_NUM_OPINIONS, 'desktop', input.OPINION_IDEA)
     count = Opinion.objects.filter(
             type=input.OPINION_IDEA.id).count()
     eq_(count, DEFAULT_NUM_OPINIONS)
Ejemplo n.º 10
0
 def setUp(self):
     # add more opinions so we can test things.
     populate(1000, 'desktop', OPINION_IDEA)
     super(PaginationTest, self).setUp()
Ejemplo n.º 11
0
 def setUp(self):
     populate(20, 'desktop', OPINION_RATING)
     populate(2, 'desktop', OPINION_IDEA)
     super(NoRatingsSearchTest, self).setUp()
Ejemplo n.º 12
0
 def test_populate(self):
     populate()
     eq_(Opinion.objects.count(), DEFAULT_NUM_OPINIONS)
Ejemplo n.º 13
0
 def test_populate_type(self):
     populate(DEFAULT_NUM_OPINIONS, 'desktop', input.OPINION_IDEA)
     count = Opinion.objects.filter(
             _type=input.OPINION_IDEA.id).count()
     eq_(count, DEFAULT_NUM_OPINIONS)