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
adcfcb93
authored
Oct 08, 2014
by
Paul Kilgo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set up property redirects to basekey
parent
a1d8d854
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
django_sshkey/models.py
+16
-0
django_sshkey/tests.py
+28
-0
No files found.
django_sshkey/models.py
View file @
adcfcb93
...
@@ -110,6 +110,22 @@ class ApplicationKey(models.Model):
...
@@ -110,6 +110,22 @@ class ApplicationKey(models.Model):
def
key
(
self
):
def
key
(
self
):
return
self
.
basekey
.
key
return
self
.
basekey
.
key
@property
def
fingerprint
(
self
):
return
self
.
basekey
.
fingerprint
@property
def
created
(
self
):
return
self
.
basekey
.
created
@property
def
last_modified
(
self
):
return
self
.
basekey
.
last_modified
@property
def
last_used
(
self
):
return
self
.
basekey
.
last_used
class
NamedKey
(
ApplicationKey
):
class
NamedKey
(
ApplicationKey
):
name
=
models
.
CharField
(
max_length
=
50
,
blank
=
True
)
name
=
models
.
CharField
(
max_length
=
50
,
blank
=
True
)
class
Meta
:
class
Meta
:
...
...
django_sshkey/tests.py
View file @
adcfcb93
...
@@ -180,6 +180,34 @@ class KeyCreationTestCase(BaseTestCase):
...
@@ -180,6 +180,34 @@ class KeyCreationTestCase(BaseTestCase):
)
)
self
.
assertRaises
(
ValidationError
,
key
.
full_clean
)
self
.
assertRaises
(
ValidationError
,
key
.
full_clean
)
class
ApplicationKeyTestCase
(
BaseTestCase
):
@classmethod
def
setUpClass
(
cls
):
super
(
ApplicationKeyTestCase
,
cls
)
.
setUpClass
()
# key1 has a comment
cls
.
key1_path
=
os
.
path
.
join
(
cls
.
key_dir
,
'key1'
)
ssh_keygen
(
comment
=
'comment'
,
file
=
cls
.
key1_path
)
cls
.
key1
=
Key
(
key
=
open
(
cls
.
key1_path
+
'.pub'
)
.
read
())
cls
.
key1
.
full_clean
()
cls
.
key1
.
save
()
cls
.
app_key1
=
TestApplicationKey
(
basekey
=
cls
.
key1
)
cls
.
app_key1
.
save
()
def
test_key_attribute
(
self
):
self
.
assertEqual
(
self
.
key1
.
key
,
self
.
app_key1
.
key
)
def
test_fingerprint_attribute
(
self
):
self
.
assertEqual
(
self
.
key1
.
fingerprint
,
self
.
app_key1
.
fingerprint
)
def
test_created_attribute
(
self
):
self
.
assertEqual
(
self
.
key1
.
created
,
self
.
app_key1
.
created
)
def
test_last_modified_attribute
(
self
):
self
.
assertEqual
(
self
.
key1
.
last_modified
,
self
.
app_key1
.
last_modified
)
def
test_last_used_attribute
(
self
):
self
.
assertEqual
(
self
.
key1
.
last_used
,
self
.
app_key1
.
last_used
)
class
NamedKeyTestCase
(
BaseTestCase
):
class
NamedKeyTestCase
(
BaseTestCase
):
@classmethod
@classmethod
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
...
...
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