Merge pull request #282 from dkg/keyserver-prefs

KeyServerPreferences is a bitfield, not a list
This commit is contained in:
Michael Greene
2019-10-26 10:09:33 -07:00
committed by GitHub
4 changed files with 6 additions and 5 deletions

View File

@@ -433,8 +433,7 @@ class SignatureType(IntEnum):
ThirdParty_Confirmation = 0x50
class KeyServerPreferences(IntEnum):
Unknown = 0x00
class KeyServerPreferences(FlagEnum):
NoModify = 0x80

View File

@@ -690,7 +690,7 @@ class PreferredCompressionAlgorithms(FlagList):
__flags__ = CompressionAlgorithm
class KeyServerPreferences(FlagList):
class KeyServerPreferences(ByteFlag):
__typeid__ = 0x17
__flags__ = _KeyServerPreferences

View File

@@ -1927,6 +1927,8 @@ class PGPKey(Armorable, ParentRef, PGPObject):
:keyword keyserver: Specify the URI of the preferred key server of the user.
This keyword is ignored for non-self-certifications.
:type keyserver: ``str``, ``unicode``, ``bytes``
:keyword keyserver_flags: A set of Key Server Preferences, as :py:obj:`~constants.KeyServerPreferences`.
:type keyserver_flags: ``set``
:keyword primary: Whether or not to consider the certified User ID as the primary one.
This keyword is ignored for non-self-certifications, and any certifications directly on keys.
:type primary: ``bool``

View File

@@ -335,7 +335,7 @@ class TestPGPKey_Management(object):
hashes=[HashAlgorithm.SHA384],
compression=[CompressionAlgorithm.ZLIB],
key_expiration=expiration,
keyserver_flags=0x80,
keyserver_flags={KeyServerPreferences.NoModify},
keyserver='about:none',
primary=False)
@@ -348,7 +348,7 @@ class TestPGPKey_Management(object):
assert sig.features == {Features.ModificationDetection}
assert sig.key_expiration == expiration - key.created
assert sig.keyserver == 'about:none'
assert sig.keyserverprefs == [KeyServerPreferences.NoModify]
assert sig.keyserverprefs == {KeyServerPreferences.NoModify}
assert uid.is_primary is False