Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
5a0236b0
Commit
5a0236b0
authored
Nov 27, 2014
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
5204d196
651fa77a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
15 deletions
+73
-15
weblate/trans/tests/test_admin.py
weblate/trans/tests/test_admin.py
+0
-15
weblate/trans/tests/test_ssh.py
weblate/trans/tests/test_ssh.py
+73
-0
No files found.
weblate/trans/tests/test_admin.py
View file @
5a0236b0
...
...
@@ -20,17 +20,13 @@
from
weblate.trans.tests.test_views
import
ViewTestCase
import
weblate.trans.ssh
from
django.test
import
TestCase
from
django.core.urlresolvers
import
reverse
from
django.utils.unittest
import
SkipTest
from
weblate.trans.tests.utils
import
get_test_file
from
weblate.trans.util
import
add_configuration_error
import
tempfile
import
shutil
import
os
TEST_HOSTS
=
get_test_file
(
'known_hosts'
)
class
AdminTest
(
ViewTestCase
):
'''
...
...
@@ -153,14 +149,3 @@ class AdminTest(ViewTestCase):
}
)
self
.
assertRedirects
(
response
,
url
)
class
SSHKeysTest
(
TestCase
):
def
test_parse
(
self
):
try
:
backup
=
weblate
.
trans
.
ssh
.
KNOWN_HOSTS_FILE
weblate
.
trans
.
ssh
.
KNOWN_HOSTS_FILE
=
TEST_HOSTS
hosts
=
weblate
.
trans
.
ssh
.
get_host_keys
()
self
.
assertEqual
(
len
(
hosts
),
50
)
finally
:
weblate
.
trans
.
ssh
.
KNOWN_HOSTS_FILE
=
backup
weblate/trans/tests/test_ssh.py
0 → 100644
View file @
5a0236b0
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2014 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import
tempfile
import
os
import
shutil
from
django.test
import
TestCase
import
weblate.trans.ssh
from
weblate.trans.tests.utils
import
get_test_file
TEST_HOSTS
=
get_test_file
(
'known_hosts'
)
class
SSHTest
(
TestCase
):
'''
Tests for customized admin interface.
'''
_tempdir
=
None
def
setUp
(
self
):
super
(
SSHTest
,
self
).
setUp
()
self
.
_tempdir
=
tempfile
.
mkdtemp
()
def
tearDown
(
self
):
if
self
.
_tempdir
is
not
None
:
shutil
.
rmtree
(
self
.
_tempdir
)
def
test_parse
(
self
):
try
:
backup
=
weblate
.
trans
.
ssh
.
KNOWN_HOSTS_FILE
weblate
.
trans
.
ssh
.
KNOWN_HOSTS_FILE
=
TEST_HOSTS
hosts
=
weblate
.
trans
.
ssh
.
get_host_keys
()
self
.
assertEqual
(
len
(
hosts
),
50
)
finally
:
weblate
.
trans
.
ssh
.
KNOWN_HOSTS_FILE
=
backup
def
test_create_ssh_wrapper
(
self
):
try
:
backup_dir
=
weblate
.
trans
.
ssh
.
WEBLATE_DIR
backup_ssh_wrapper
=
weblate
.
trans
.
ssh
.
SSH_WRAPPER
weblate
.
trans
.
ssh
.
WEBLATE_DIR
=
os
.
path
.
join
(
self
.
_tempdir
,
'wl'
)
weblate
.
trans
.
ssh
.
SSH_WRAPPER
=
os
.
path
.
join
(
weblate
.
trans
.
ssh
.
WEBLATE_DIR
,
'ssh-wrapper'
)
weblate
.
trans
.
ssh
.
create_ssh_wrapper
()
with
open
(
weblate
.
trans
.
ssh
.
SSH_WRAPPER
,
'r'
)
as
handle
:
self
.
assertTrue
(
weblate
.
trans
.
ssh
.
KNOWN_HOSTS_FILE
in
handle
.
read
()
)
self
.
assertTrue
(
os
.
access
(
weblate
.
trans
.
ssh
.
SSH_WRAPPER
,
os
.
X_OK
)
)
finally
:
weblate
.
trans
.
ssh
.
WEBLATE_DIR
=
backup_dir
weblate
.
trans
.
ssh
.
SSH_WRAPPER
=
backup_ssh_wrapper
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment