def test_dont_throw_error_if_pagination_is_off(self): unpaginated_sms_bread = SMSBread() unpaginated_sms_bread.browse_view.paginate_by = None browse_view = unpaginated_sms_bread.get_browse_view() context = browse_view(self.request).context_data self.assertFalse(context['paginator']) self.assertEqual(context['is_paginated'], False)
def setUp(self): super(PaginationContext, self).setUp() self.factory = RequestFactory() self.url = reverse('browse_messages') self.request = self.create_request(self.url) sms_bread = SMSBread() # paginate by 1, to make it easier to test pages sms_bread.browse_view.paginate_by = 1 self.browse_view = sms_bread.get_browse_view()
from django.conf.urls import url, include from register.views import SMSBread, StaffPhoneBread, delete_all_staff_phones, \ BlacklistedNumberBread, upload_blacklisted_numbers, download_blacklisted_numbers, \ delete_all_blacklisted_numbers, \ WhitelistedNumberBread, upload_whitelisted_numbers, download_whitelisted_numbers, \ delete_all_whitelisted_numbers urlpatterns = ( # /sms: url(r'', include(BlacklistedNumberBread().get_urls())), url(r'', include(WhitelistedNumberBread().get_urls())), url(r'', include(StaffPhoneBread().get_urls())), url(r'', include(SMSBread().get_urls())), # Non-BREAD operations on black/whitelisted numbers url(r'^blacklisted-numbers/delete/$', delete_all_blacklisted_numbers, name='blacklisted-numbers-delete'), url(r'^blacklistednumbers/upload/$', upload_blacklisted_numbers, name='blacklisted-numbers-upload'), url(r'^blacklistednumbers/download/$', download_blacklisted_numbers, name='blacklisted-numbers-download'), url(r'^whitelisted-numbers/delete/$', delete_all_whitelisted_numbers, name='whitelisted-numbers-delete'), url(r'^whitelistednumbers/upload/$', upload_whitelisted_numbers, name='whitelisted-numbers-upload'),