Fix up unicode project directory issue, with unit tests

This commit is contained in:
Matthew Jones
2014-12-15 14:17:07 -05:00
parent d410e1aa2c
commit 9e962d4d5b
2 changed files with 7 additions and 3 deletions

View File

@@ -174,11 +174,15 @@ class BaseTestMixin(object):
return results
def make_project(self, name, description='', created_by=None,
playbook_content='', role_playbooks=None):
playbook_content='', role_playbooks=None, unicode_prefix=True):
if not os.path.exists(settings.PROJECTS_ROOT):
os.makedirs(settings.PROJECTS_ROOT)
# Create temp project directory.
project_dir = tempfile.mkdtemp(dir=settings.PROJECTS_ROOT)
if unicode_prefix:
tmp_prefix = u'\u2620tmp'
else:
tmp_prefix = 'tmp'
project_dir = tempfile.mkdtemp(prefix=tmp_prefix, dir=settings.PROJECTS_ROOT)
self._temp_paths.append(project_dir)
# Create temp playbook in project (if playbook content is given).
if playbook_content: