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()
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()
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()
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')
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')
def setup_class(cls): # add more opinions so we can test things. populate(1000, 'desktop', OPINION_IDEA) super(PaginationTest, cls).setup_class()
def test_populate(self): populate() eq_(Opinion.objects.count(), DEFAULT_NUM_OPINIONS)
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)
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)
def setUp(self): # add more opinions so we can test things. populate(1000, 'desktop', OPINION_IDEA) super(PaginationTest, self).setUp()
def setUp(self): populate(20, 'desktop', OPINION_RATING) populate(2, 'desktop', OPINION_IDEA) super(NoRatingsSearchTest, self).setUp()
def test_populate(self): populate() eq_(Opinion.objects.count(), DEFAULT_NUM_OPINIONS)
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)