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
8231e1a7
Commit
8231e1a7
authored
Oct 10, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for ssh key generating
parent
f5af391d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
3 deletions
+30
-3
trans/tests/admin.py
trans/tests/admin.py
+30
-3
No files found.
trans/tests/admin.py
View file @
8231e1a7
...
...
@@ -23,6 +23,9 @@ import trans.admin_views
from
django.test
import
TestCase
from
django.core.urlresolvers
import
reverse
from
trans.tests.util
import
get_test_file
import
tempfile
import
shutil
import
os
TEST_HOSTS
=
get_test_file
(
'known_hosts'
)
...
...
@@ -45,6 +48,26 @@ class AdminTest(ViewTestCase):
response
=
self
.
client
.
get
(
reverse
(
'admin-ssh'
))
self
.
assertContains
(
response
,
'SSH keys'
)
def
test_ssh_generate
(
self
):
tempdir
=
tempfile
.
mkdtemp
()
rsafile
=
os
.
path
.
join
(
tempdir
,
'id_rsa.pub'
)
try
:
backup
=
trans
.
admin_views
.
RSA_KEY_FILE
trans
.
admin_views
.
RSA_KEY_FILE
=
rsafile
response
=
self
.
client
.
get
(
reverse
(
'admin-ssh'
))
self
.
assertContains
(
response
,
'Generate SSH key'
)
response
=
self
.
client
.
post
(
reverse
(
'admin-ssh'
),
{
'action'
:
'generate'
}
)
self
.
assertContains
(
response
,
'Created new SSH key'
)
finally
:
trans
.
admin_views
.
RSA_KEY_FILE
=
backup
shutil
.
rmtree
(
tempdir
)
def
test_performace
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'admin-performance'
))
self
.
assertContains
(
response
,
'Django caching'
)
...
...
@@ -66,6 +89,10 @@ class AdminTest(ViewTestCase):
class
SSHKeysTest
(
TestCase
):
def
test_parse
(
self
):
trans
.
admin_views
.
KNOWN_HOSTS_FILE
=
TEST_HOSTS
hosts
=
trans
.
admin_views
.
get_host_keys
()
self
.
assertEqual
(
len
(
hosts
),
50
)
try
:
backup
=
trans
.
admin_views
.
KNOWN_HOSTS_FILE
trans
.
admin_views
.
KNOWN_HOSTS_FILE
=
TEST_HOSTS
hosts
=
trans
.
admin_views
.
get_host_keys
()
self
.
assertEqual
(
len
(
hosts
),
50
)
finally
:
trans
.
admin_views
.
KNOWN_HOSTS_FILE
=
backup
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