Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
0a9a0b21
Commit
0a9a0b21
authored
Oct 21, 2012
by
Clément Schreiner
Browse files
Test and fix user id extraction.
parent
82ce23e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
debexpo/lib/gnupg.py
View file @
0a9a0b21
...
...
@@ -240,7 +240,7 @@ class GnuPG(object):
uid_name
=
m
.
group
(
'uid_name'
)
uid_email
=
m
.
group
(
'uid_email'
)
user_id
=
GpgUserId
(
uid_name
,
uid_email
)
user_ids
.
append
(
GpgU
ser
I
d
)
user_ids
.
append
(
u
ser
_i
d
)
if
key
is
not
None
:
return
GpgKeyBlock
(
key
,
user_ids
)
...
...
debexpo/tests/test_gnupg.py
View file @
0a9a0b21
...
...
@@ -41,7 +41,7 @@ import os
import
pylons.test
from
debexpo.lib.gnupg
import
GnuPG
from
debexpo.lib.gnupg
import
GnuPG
,
GpgUserId
test_gpg_key
=
\
"""-----BEGIN PGP PUBLIC KEY BLOCK-----
...
...
@@ -125,6 +125,17 @@ class TestGnuPGController(TestCase):
key_string
=
gnupg
.
key2string
(
parsed_key_block
.
key
)
self
.
assertEqual
(
key_string
,
test_gpg_key_id
)
def
testParseUserID
(
self
):
"""
Test the extraction of user ids from a given GPG key.
"""
gnupg
=
self
.
_get_gnupg
()
self
.
assertFalse
(
gnupg
.
is_unusable
)
parsed_key_block
=
gnupg
.
parse_key_block
(
test_gpg_key
)
(
k
,
u
)
=
parsed_key_block
self
.
assertEqual
(
u
,
[
GpgUserId
(
'Serafeim Zanikolas'
,
'serzan@hellug.gr'
)])
def
testParseInvalidKeyBlock
(
self
):
gnupg
=
self
.
_get_gnupg
()
self
.
assertFalse
(
gnupg
.
is_unusable
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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