Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-sshkey
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1af7de2c
authored
Aug 28, 2013
by
Scott Duckworth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use sets instead of sorted arrays
parent
128b7796
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
sshkey/tests.py
+16
-16
No files found.
sshkey/tests.py
View file @
1af7de2c
...
@@ -232,13 +232,13 @@ class UserKeyLookupTestCase(BaseTestCase):
...
@@ -232,13 +232,13 @@ class UserKeyLookupTestCase(BaseTestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertIn
(
'Content-Type'
,
response
)
self
.
assertIn
(
'Content-Type'
,
response
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/plain'
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/plain'
)
actual_content
=
response
.
content
.
strip
()
.
split
(
'
\n
'
)
actual_content
=
set
(
response
.
content
.
strip
()
.
split
(
'
\n
'
)
)
correct_content
=
[
correct_content
=
set
((
'command="user1" '
+
open
(
self
.
key1_path
+
'.pub'
)
.
read
()
.
strip
(),
'command="user1" '
+
open
(
self
.
key1_path
+
'.pub'
)
.
read
()
.
strip
(),
'command="user1" '
+
open
(
self
.
key2_path
+
'.pub'
)
.
read
()
.
strip
(),
'command="user1" '
+
open
(
self
.
key2_path
+
'.pub'
)
.
read
()
.
strip
(),
'command="user2" '
+
open
(
self
.
key3_path
+
'.pub'
)
.
read
()
.
strip
(),
'command="user2" '
+
open
(
self
.
key3_path
+
'.pub'
)
.
read
()
.
strip
(),
]
))
self
.
assertEqual
(
sorted
(
actual_content
),
sorted
(
correct_content
)
)
self
.
assertEqual
(
actual_content
,
correct_content
)
def
test_lookup_by_fingerprint
(
self
):
def
test_lookup_by_fingerprint
(
self
):
client
=
Client
()
client
=
Client
()
...
@@ -249,11 +249,11 @@ class UserKeyLookupTestCase(BaseTestCase):
...
@@ -249,11 +249,11 @@ class UserKeyLookupTestCase(BaseTestCase):
self
.
assertIn
(
'Content-Type'
,
response
)
self
.
assertIn
(
'Content-Type'
,
response
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/plain'
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/plain'
)
username
=
self
.
user1
.
username
username
=
self
.
user1
.
username
actual_content
=
response
.
content
.
strip
()
.
split
(
'
\n
'
)
actual_content
=
set
(
response
.
content
.
strip
()
.
split
(
'
\n
'
)
)
correct_content
=
[
correct_content
=
set
((
'command="user1" '
+
open
(
self
.
key1_path
+
'.pub'
)
.
read
()
.
strip
(),
'command="user1" '
+
open
(
self
.
key1_path
+
'.pub'
)
.
read
()
.
strip
(),
]
))
self
.
assertEqual
(
sorted
(
actual_content
),
sorted
(
correct_content
)
)
self
.
assertEqual
(
actual_content
,
correct_content
)
def
test_lookup_by_username_single_result
(
self
):
def
test_lookup_by_username_single_result
(
self
):
client
=
Client
()
client
=
Client
()
...
@@ -264,11 +264,11 @@ class UserKeyLookupTestCase(BaseTestCase):
...
@@ -264,11 +264,11 @@ class UserKeyLookupTestCase(BaseTestCase):
self
.
assertIn
(
'Content-Type'
,
response
)
self
.
assertIn
(
'Content-Type'
,
response
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/plain'
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/plain'
)
body
=
open
(
self
.
key1_path
+
'.pub'
)
.
read
()
.
strip
()
body
=
open
(
self
.
key1_path
+
'.pub'
)
.
read
()
.
strip
()
actual_content
=
response
.
content
.
strip
()
.
split
(
'
\n
'
)
actual_content
=
set
(
response
.
content
.
strip
()
.
split
(
'
\n
'
)
)
correct_content
=
[
correct_content
=
set
((
'command="user2" '
+
open
(
self
.
key3_path
+
'.pub'
)
.
read
()
.
strip
(),
'command="user2" '
+
open
(
self
.
key3_path
+
'.pub'
)
.
read
()
.
strip
(),
]
))
self
.
assertEqual
(
sorted
(
actual_content
),
sorted
(
correct_content
)
)
self
.
assertEqual
(
actual_content
,
correct_content
)
def
test_lookup_by_username_multiple_results
(
self
):
def
test_lookup_by_username_multiple_results
(
self
):
client
=
Client
()
client
=
Client
()
...
@@ -279,12 +279,12 @@ class UserKeyLookupTestCase(BaseTestCase):
...
@@ -279,12 +279,12 @@ class UserKeyLookupTestCase(BaseTestCase):
self
.
assertIn
(
'Content-Type'
,
response
)
self
.
assertIn
(
'Content-Type'
,
response
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/plain'
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/plain'
)
body
=
open
(
self
.
key1_path
+
'.pub'
)
.
read
()
.
strip
()
body
=
open
(
self
.
key1_path
+
'.pub'
)
.
read
()
.
strip
()
actual_content
=
response
.
content
.
strip
()
.
split
(
'
\n
'
)
actual_content
=
set
(
response
.
content
.
strip
()
.
split
(
'
\n
'
)
)
correct_content
=
[
correct_content
=
set
((
'command="user1" '
+
open
(
self
.
key1_path
+
'.pub'
)
.
read
()
.
strip
(),
'command="user1" '
+
open
(
self
.
key1_path
+
'.pub'
)
.
read
()
.
strip
(),
'command="user1" '
+
open
(
self
.
key2_path
+
'.pub'
)
.
read
()
.
strip
(),
'command="user1" '
+
open
(
self
.
key2_path
+
'.pub'
)
.
read
()
.
strip
(),
]
))
self
.
assertEqual
(
sorted
(
actual_content
),
sorted
(
correct_content
)
)
self
.
assertEqual
(
actual_content
,
correct_content
)
def
test_lookup_nonexist_fingerprint
(
self
):
def
test_lookup_nonexist_fingerprint
(
self
):
client
=
Client
()
client
=
Client
()
...
...
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