Instead of inserting the path of the apps into the Python app, the apps are now referenced by their full import path. This solves name clashes with external or native Python libraries. Example: Mayan statistics app vs. Python new statistics library. Every app reference is now prepended with 'mayan.apps'. Existing config.yml files need to be updated manually. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
36 lines
1007 B
Python
36 lines
1007 B
Python
from __future__ import unicode_literals
|
|
|
|
import os
|
|
import shutil
|
|
|
|
from mayan.apps.common.tests import BaseTestCase
|
|
from mayan.apps.common.utils import mkdtemp
|
|
from mayan.apps.documents.tests import TEST_NON_ASCII_DOCUMENT_PATH
|
|
|
|
from ..classes import StagingFile
|
|
|
|
|
|
class StagingFileTestCase(BaseTestCase):
|
|
def test_unicode_staging_file(self):
|
|
temporary_directory = mkdtemp()
|
|
shutil.copy(TEST_NON_ASCII_DOCUMENT_PATH, temporary_directory)
|
|
|
|
filename = os.path.basename(TEST_NON_ASCII_DOCUMENT_PATH)
|
|
|
|
class MockStagingFolder(object):
|
|
self.folder_path = temporary_directory
|
|
|
|
staging_file_1 = StagingFile(
|
|
staging_folder=MockStagingFolder(),
|
|
filename=filename
|
|
)
|
|
|
|
staging_file_2 = StagingFile(
|
|
staging_folder=MockStagingFolder(),
|
|
encoded_filename=staging_file_1.encoded_filename
|
|
)
|
|
|
|
self.assertEqual(filename, staging_file_2.filename)
|
|
|
|
shutil.rmtree(temporary_directory)
|