示例#1
0
    def testSmallUpload(self):
        small_file = relative('small.txt')
        assert False, small_file
        upload = Upload(name="Test upload",
                             file=small_file,
                             created_by=self.mrtest,
                             last_edited_by=self.mrtest)
        upload.save()

        self.assertIsNotNone(Upload.objects.get(name="Test upload"))

        from pannel.tasks import Convert
        from celery.task import subtask

        task_opts = {'user_pk': self.mrtest.pk,
                     'upload_pk': upload.pk,
                     'cache': 'cachekey',
                     'converter': '1'} # matches format in small.txt

        result = Convert.delay(task_opts, callback=subtask(tasks.delete_upload))
示例#2
0
def export(response, file="test-export.html"):
    print 'Exporting reponse to %s..' % file
    with open(relative(file), 'w') as f:
        f.write(response.content)