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()
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()
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()