Ejemplo n.º 1
0
    def setUp(self):
        self.document = models.Document(title="Test document")
        self.document.file.save('example.doc',
                                ContentFile("A boring example document"))

        self.extensionless_document = models.Document(title="Test document")
        self.extensionless_document.file.save(
            'example', ContentFile("A boring example document"))
Ejemplo n.º 2
0
    def setUp(self):
        self.login()

        self.document = models.Document(title='Test')
        self.document.file.save('test_edit_view.txt',
                                ContentFile('A test content.'))
        self.edit_url = reverse('wagtaildocs:edit', args=(self.document.pk, ))
        self.storage = self.document.file.storage
Ejemplo n.º 3
0
    def setUp(self):
        self.document = models.Document(title="Test document")

        # Setting this filename in the content-disposition header fails on Django <1.8, Python 2
        # due to https://code.djangoproject.com/ticket/20889
        self.filename = 'docs\u0627\u0644\u0643\u0627\u062a\u062f\u0631\u0627\u064a\u064a\u0629_\u0648\u0627\u0644\u0633\u0648\u0642'
        try:
            self.document.file.save(self.filename, ContentFile("A boring example document"))
        except UnicodeEncodeError:
            raise unittest.SkipTest("Filesystem doesn't support unicode filenames")
Ejemplo n.º 4
0
    def setUp(self):
        # Import using a try-catch block to prevent crashes if the
        # django-sendfile module is not installed
        try:
            import sendfile  # noqa
        except ImportError:
            raise unittest.SkipTest("django-sendfile not installed")

        self.document = models.Document(title="Test document")
        self.document.file.save('example.doc', ContentFile("A boring example document"))
Ejemplo n.º 5
0
    def setUp(self):
        self.document = models.Document(title="Test document")

        self.filename = 'docs\u0627\u0644\u0643\u0627\u062a\u062f\u0631\u0627'
        '\u064a\u064a\u0629_\u0648\u0627\u0644\u0633\u0648\u0642'
        try:
            self.document.file.save(self.filename,
                                    ContentFile("A boring example document"))
        except UnicodeEncodeError:
            raise unittest.SkipTest(
                "Filesystem doesn't support unicode filenames")
Ejemplo n.º 6
0
 def make_docs(self):
     for i in range(50):
         document = models.Document(title="Test " + str(i))
         document.save()