Exemplo n.º 1
0
def register_admin_urls():
    return [
        url(r'^cdn/$', manage_cdn, name='manage-cdn'),
        url(r'^export-feedback/$',
            ExportFeedbackView.as_view(),
            name='export-feedback'),
    ]
Exemplo n.º 2
0
    def test_post_generates_zipfile(self):
        request = RequestFactory().post('/', {
            'from_date': '2019-01-01',
            'to_date': '2019-03-31',
        })
        request.user = get_user_model().objects.get(is_superuser=True)

        response = ExportFeedbackView.as_view()(request)

        self.assertEqual(response['Content-Type'], 'application/zip')
        self.assertEqual(
            response['Content-Disposition'],
            'attachment;filename=feedback_20190101_to_20190331.zip')
Exemplo n.º 3
0
    def test_post_generates_zipfile(self):
        request = RequestFactory().post("/", {
            "from_date": "2019-01-01",
            "to_date": "2019-03-31",
        })
        request.user = get_user_model().objects.get(is_superuser=True)

        response = ExportFeedbackView.as_view()(request)

        self.assertEqual(response["Content-Type"], "application/zip")
        self.assertEqual(
            response["Content-Disposition"],
            "attachment;filename=feedback_20190101_to_20190331.zip",
        )
    def test_post_generates_zipfile(self):
        root_page = Site.objects.get(is_default_site=True).root_page
        save_new_page(
            SimplePage(
                title='Ask CFPB',
                slug='ask-cfpb',
                content='ask cfpb'
            ),
            root=root_page
        )
        save_new_page(
            SimplePage(
                title='Obtener respuestas',
                slug='obtener-respuestas',
                content='obtener respuestas'
            ),
            root=root_page
        )
        save_new_page(
            SimplePage(
                title='Buying a House',
                slug='owning-a-home',
                content='buying a house'
            ),
            root=root_page
        )

        request = RequestFactory().post(
            "/", {"from_date": "2019-01-01", "to_date": "2019-03-31"}
        )
        request.user = get_user_model().objects.get(is_superuser=True)

        response = ExportFeedbackView.as_view()(request)

        self.assertEqual(response["Content-Type"], "application/zip")
        self.assertEqual(
            response["Content-Disposition"],
            "attachment;filename=feedback_20190101_to_20190331.zip",
        )
 def test_get_most_recent_quarter_apr1(self):
     self.assertEqual(
         ExportFeedbackView.get_most_recent_quarter(date(2019, 4, 1)),
         (date(2019, 1, 1), date(2019, 3, 31)),
     )
 def test_get_most_recent_quarter_mar31(self):
     self.assertEqual(
         ExportFeedbackView.get_most_recent_quarter(date(2019, 3, 31)),
         (date(2018, 10, 1), date(2018, 12, 31)),
     )