Commit 1a3ed4a7 authored by Michal Čihař's avatar Michal Čihař

Do directory setup when testing SSH handling

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 519db423
......@@ -24,6 +24,7 @@ from weblate.trans.util import add_configuration_error
from weblate import appsettings
from weblate.trans.tests import OverrideSettings
from weblate.trans.tests.utils import get_test_file
from weblate.trans.data import check_data_writable
import os
......@@ -47,6 +48,7 @@ class AdminTest(ViewTestCase):
@OverrideSettings(DATA_DIR=OverrideSettings.TEMP_DIR)
def test_ssh_generate(self):
check_data_writable()
response = self.client.get(reverse('admin-ssh'))
self.assertContains(response, 'Generate SSH key')
......@@ -58,6 +60,7 @@ class AdminTest(ViewTestCase):
@OverrideSettings(DATA_DIR=OverrideSettings.TEMP_DIR)
def test_ssh_add(self):
check_data_writable()
try:
oldpath = os.environ['PATH']
os.environ['PATH'] = ':'.join(
......
......@@ -24,6 +24,7 @@ from django.test import TestCase
from weblate.trans.ssh import get_host_keys, create_ssh_wrapper, ssh_file
from weblate.trans.tests.utils import get_test_file
from weblate.trans.tests import OverrideSettings
from weblate.trans.data import check_data_writable
from weblate import appsettings
......@@ -36,14 +37,14 @@ class SSHTest(TestCase):
'''
@OverrideSettings(DATA_DIR=OverrideSettings.TEMP_DIR)
def test_parse(self):
tempdir = os.path.join(appsettings.DATA_DIR, 'ssh')
os.makedirs(tempdir)
shutil.copy(TEST_HOSTS, tempdir)
check_data_writable()
shutil.copy(TEST_HOSTS, os.path.join(appsettings.DATA_DIR, 'ssh'))
hosts = get_host_keys()
self.assertEqual(len(hosts), 50)
@OverrideSettings(DATA_DIR=OverrideSettings.TEMP_DIR)
def test_create_ssh_wrapper(self):
check_data_writable()
filename = os.path.join(
appsettings.DATA_DIR, 'ssh', 'ssh-weblate-wrapper'
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment