mirror of
https://github.com/OpenKMIP/PyKMIP.git
synced 2025-07-25 06:54:40 +02:00
Merge pull request #411 from OpenKMIP/bug/fix-client-crypto-params
Fix a client bug for cryptographic parameter handling
This commit is contained in:
commit
fdfbba8a0e
@ -1243,12 +1243,15 @@ class ProxyKmipClient(object):
|
|||||||
CryptographicParameters struct.
|
CryptographicParameters struct.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
None: if value is None
|
||||||
CryptographicParameters: a CryptographicParameters struct
|
CryptographicParameters: a CryptographicParameters struct
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
TypeError: if the input argument is invalid
|
TypeError: if the input argument is invalid
|
||||||
"""
|
"""
|
||||||
if not isinstance(value, dict):
|
if value is None:
|
||||||
|
return None
|
||||||
|
elif not isinstance(value, dict):
|
||||||
raise TypeError("Cryptographic parameters must be a dictionary.")
|
raise TypeError("Cryptographic parameters must be a dictionary.")
|
||||||
|
|
||||||
cryptographic_parameters = CryptographicParameters(
|
cryptographic_parameters = CryptographicParameters(
|
||||||
|
@ -2600,6 +2600,15 @@ class TestProxyKmipClient(testtools.TestCase):
|
|||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
ClientConnectionNotOpen, client.locate, *args)
|
ClientConnectionNotOpen, client.locate, *args)
|
||||||
|
|
||||||
|
def test_build_cryptographic_parameters_with_none(self):
|
||||||
|
"""
|
||||||
|
Test that an empty set of cryptographic parameters is processed
|
||||||
|
correctly.
|
||||||
|
"""
|
||||||
|
client = ProxyKmipClient()
|
||||||
|
result = client._build_cryptographic_parameters(None)
|
||||||
|
self.assertEqual(None, result)
|
||||||
|
|
||||||
def test_build_cryptographic_parameters_invalid(self):
|
def test_build_cryptographic_parameters_invalid(self):
|
||||||
"""
|
"""
|
||||||
Test that the right error is raised when attempting to build
|
Test that the right error is raised when attempting to build
|
||||||
|
Loading…
x
Reference in New Issue
Block a user