Esempio n. 1
0
 def setUp(self):
 	from epic.datasets.views import PER_PAGE
 	self.good_category = Category(id=2359237, name='test_good_category')
 	self.good_category.save()
 	self.bad_category = Category(id=6822349, name='test_bad_category')
 	self.bad_category.save()
 	save_n_datasets_with_category(User.objects.get(username="******"), PER_PAGE, self.good_category)
 	save_n_datasets_with_category(User.objects.get(username="******"), 7, self.bad_category)    	
Esempio n. 2
0
class ViewDatasetsForCategoryPaginatedTestCase(CustomTestCase):
    fixtures = ['core_just_users']

    def setUp(self):
    	from epic.datasets.views import PER_PAGE
    	self.good_category = Category(id=2359237, name='test_good_category')
    	self.good_category.save()
    	self.bad_category = Category(id=6822349, name='test_bad_category')
    	self.bad_category.save()
    	save_n_datasets_with_category(User.objects.get(username="******"), PER_PAGE, self.good_category)
    	save_n_datasets_with_category(User.objects.get(username="******"), 7, self.bad_category)    	
    
    def testPaginated(self):    	
    	response = self.client.get(reverse('epic.categories.views.view_datasets_for_category', kwargs={'category_id': self.good_category.id}))

    	self.assertNotContains(response, '<div class="pagination"')
    	
    	for dataset in _get_datasets_for_category(self.good_category):
    		self.assertContains(response, dataset.get_absolute_url())
        for dataset in _get_datasets_for_category(self.bad_category):
    		self.assertNotContains(response, dataset.get_absolute_url())
Esempio n. 3
0
def _create_category2():
    category2 = Category(name='Test Category2', description='Test Description2')
    category2.save()
    
    return category2
Esempio n. 4
0
def _create_category1():
    category1 = Category(name='Test Category1', description='Test Description1')
    category1.save()
    
    return category1