Esempio n. 1
0
    def clean_up(self):
        super(DownloadMixin, self).clean_up()

        if pdfserver.app.config['TASK_HANDLER'] == 'pdfserver.faketask':
            from pdfserver.faketask import TaskResult
            TaskResult.query.delete()
            TaskResult.commit()
Esempio n. 2
0
    def clean_up(self):
        super(DownloadMixin, self).clean_up()

        if pdfserver.app.config['TASK_HANDLER'] == 'pdfserver.faketask':
            from pdfserver.faketask import TaskResult
            TaskResult.query.delete()
            TaskResult.commit()
Esempio n. 3
0
    def test_download_expired_fails(self):
        if pdfserver.app.config['TASK_HANDLER'] == 'pdfserver.faketask':
            from pdfserver.faketask import TaskResult
            assert TaskResult.query.count() == 0

            rv = self.app.get('/')
            self.assertEquals(rv.status_code, 200)

            rv = self.app.post('/handleform',
                            data={'file': (self.get_pdf_stream(), 'test.pdf')})

            # Start build
            download_url, id = self._combine()

            task_result = TaskResult.get_for_task_id(id)
            task_result.available = False
            TaskResult.add(task_result)

            # Download
            rv = self.app.get(download_url)
            self.assertEquals(rv.status_code, 410)

            self.clean_up()
Esempio n. 4
0
    def test_download_expired_fails(self):
        if pdfserver.app.config['TASK_HANDLER'] == 'pdfserver.faketask':
            from pdfserver.faketask import TaskResult
            assert TaskResult.query.count() == 0

            rv = self.app.get('/')
            self.assertEquals(rv.status_code, 200)

            rv = self.app.post(
                '/handleform',
                data={'file': (self.get_pdf_stream(), 'test.pdf')})

            # Start build
            download_url, id = self._combine()

            task_result = TaskResult.get_for_task_id(id)
            task_result.available = False
            TaskResult.add(task_result)

            # Download
            rv = self.app.get(download_url)
            self.assertEquals(rv.status_code, 410)

            self.clean_up()