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
7a6f561c
authored
Oct 09, 2014
by
Paul Kilgo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ApplicationKey.__unicode__: tests and implementation
parent
25f4f921
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
django_sshkey/models.py
+6
-0
django_sshkey/tests.py
+9
-0
No files found.
django_sshkey/models.py
View file @
7a6f561c
...
@@ -109,6 +109,12 @@ class ApplicationKey(models.Model):
...
@@ -109,6 +109,12 @@ class ApplicationKey(models.Model):
class
Meta
:
class
Meta
:
abstract
=
True
abstract
=
True
def
__unicode__
(
self
):
try
:
return
unicode
(
self
.
basekey
)
except
Key
.
DoesNotExist
:
return
u'(no basekey)'
@property
@property
def
key
(
self
):
def
key
(
self
):
return
self
.
basekey
.
key
return
self
.
basekey
.
key
...
...
django_sshkey/tests.py
View file @
7a6f561c
...
@@ -230,6 +230,15 @@ class ApplicationKeyTestCase(BaseTestCase):
...
@@ -230,6 +230,15 @@ class ApplicationKeyTestCase(BaseTestCase):
def
test_last_used_attribute
(
self
):
def
test_last_used_attribute
(
self
):
self
.
assertEqual
(
self
.
key1
.
last_used
,
self
.
app_key1
.
last_used
)
self
.
assertEqual
(
self
.
key1
.
last_used
,
self
.
app_key1
.
last_used
)
def
test_unicode1
(
self
):
''' No basekey '''
key
=
TestApplicationKey
()
self
.
assertEqual
(
'(no basekey)'
,
unicode
(
key
))
def
test_unicode2
(
self
):
''' With basekey '''
self
.
assertEqual
(
unicode
(
self
.
key1
),
unicode
(
self
.
app_key1
))
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