mirror of https://github.com/OpenKMIP/PyKMIP.git
Update payload management
This change updates payload management, streamlining the import process for kmip.core.messages.payloads. Now any request or response payload is accessible by importing payloads. All code importing and using individual payload modules has been updated to use this new approach.
This commit is contained in:
parent
7f6f4d004f
commit
82a7b8a741
|
@ -14,83 +14,64 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from kmip.core.factories.payloads import PayloadFactory
|
from kmip.core.factories.payloads import PayloadFactory
|
||||||
|
from kmip.core.messages import payloads
|
||||||
from kmip.core.messages.payloads import activate
|
|
||||||
from kmip.core.messages.payloads import create
|
|
||||||
from kmip.core.messages.payloads import create_key_pair
|
|
||||||
from kmip.core.messages.payloads import decrypt
|
|
||||||
from kmip.core.messages.payloads import derive_key
|
|
||||||
from kmip.core.messages.payloads import destroy
|
|
||||||
from kmip.core.messages.payloads import discover_versions
|
|
||||||
from kmip.core.messages.payloads import encrypt
|
|
||||||
from kmip.core.messages.payloads import get
|
|
||||||
from kmip.core.messages.payloads import get_attribute_list
|
|
||||||
from kmip.core.messages.payloads import get_attributes
|
|
||||||
from kmip.core.messages.payloads import locate
|
|
||||||
from kmip.core.messages.payloads import query
|
|
||||||
from kmip.core.messages.payloads import rekey_key_pair
|
|
||||||
from kmip.core.messages.payloads import register
|
|
||||||
from kmip.core.messages.payloads import revoke
|
|
||||||
from kmip.core.messages.payloads import sign
|
|
||||||
from kmip.core.messages.payloads import signature_verify
|
|
||||||
from kmip.core.messages.payloads import mac
|
|
||||||
|
|
||||||
|
|
||||||
class RequestPayloadFactory(PayloadFactory):
|
class RequestPayloadFactory(PayloadFactory):
|
||||||
|
|
||||||
def _create_create_payload(self):
|
def _create_create_payload(self):
|
||||||
return create.CreateRequestPayload()
|
return payloads.CreateRequestPayload()
|
||||||
|
|
||||||
def _create_create_key_pair_payload(self):
|
def _create_create_key_pair_payload(self):
|
||||||
return create_key_pair.CreateKeyPairRequestPayload()
|
return payloads.CreateKeyPairRequestPayload()
|
||||||
|
|
||||||
def _create_register_payload(self):
|
def _create_register_payload(self):
|
||||||
return register.RegisterRequestPayload()
|
return payloads.RegisterRequestPayload()
|
||||||
|
|
||||||
def _create_derive_key_payload(self):
|
def _create_derive_key_payload(self):
|
||||||
return derive_key.DeriveKeyRequestPayload()
|
return payloads.DeriveKeyRequestPayload()
|
||||||
|
|
||||||
def _create_rekey_key_pair_payload(self):
|
def _create_rekey_key_pair_payload(self):
|
||||||
return rekey_key_pair.RekeyKeyPairRequestPayload()
|
return payloads.RekeyKeyPairRequestPayload()
|
||||||
|
|
||||||
def _create_locate_payload(self):
|
def _create_locate_payload(self):
|
||||||
return locate.LocateRequestPayload()
|
return payloads.LocateRequestPayload()
|
||||||
|
|
||||||
def _create_get_payload(self):
|
def _create_get_payload(self):
|
||||||
return get.GetRequestPayload()
|
return payloads.GetRequestPayload()
|
||||||
|
|
||||||
def _create_get_attribute_list_payload(self):
|
def _create_get_attribute_list_payload(self):
|
||||||
return get_attribute_list.GetAttributeListRequestPayload()
|
return payloads.GetAttributeListRequestPayload()
|
||||||
|
|
||||||
def _create_get_attributes_payload(self):
|
def _create_get_attributes_payload(self):
|
||||||
return get_attributes.GetAttributesRequestPayload()
|
return payloads.GetAttributesRequestPayload()
|
||||||
|
|
||||||
def _create_destroy_payload(self):
|
def _create_destroy_payload(self):
|
||||||
return destroy.DestroyRequestPayload()
|
return payloads.DestroyRequestPayload()
|
||||||
|
|
||||||
def _create_query_payload(self):
|
def _create_query_payload(self):
|
||||||
return query.QueryRequestPayload()
|
return payloads.QueryRequestPayload()
|
||||||
|
|
||||||
def _create_discover_versions_payload(self):
|
def _create_discover_versions_payload(self):
|
||||||
return discover_versions.DiscoverVersionsRequestPayload()
|
return payloads.DiscoverVersionsRequestPayload()
|
||||||
|
|
||||||
def _create_activate_payload(self):
|
def _create_activate_payload(self):
|
||||||
return activate.ActivateRequestPayload()
|
return payloads.ActivateRequestPayload()
|
||||||
|
|
||||||
def _create_revoke_payload(self):
|
def _create_revoke_payload(self):
|
||||||
return revoke.RevokeRequestPayload()
|
return payloads.RevokeRequestPayload()
|
||||||
|
|
||||||
def _create_mac_payload(self):
|
def _create_mac_payload(self):
|
||||||
return mac.MACRequestPayload()
|
return payloads.MACRequestPayload()
|
||||||
|
|
||||||
def _create_encrypt_payload(self):
|
def _create_encrypt_payload(self):
|
||||||
return encrypt.EncryptRequestPayload()
|
return payloads.EncryptRequestPayload()
|
||||||
|
|
||||||
def _create_decrypt_payload(self):
|
def _create_decrypt_payload(self):
|
||||||
return decrypt.DecryptRequestPayload()
|
return payloads.DecryptRequestPayload()
|
||||||
|
|
||||||
def _create_sign_payload(self):
|
def _create_sign_payload(self):
|
||||||
return sign.SignRequestPayload()
|
return payloads.SignRequestPayload()
|
||||||
|
|
||||||
def _create_signature_verify_payload(self):
|
def _create_signature_verify_payload(self):
|
||||||
return signature_verify.SignatureVerifyRequestPayload()
|
return payloads.SignatureVerifyRequestPayload()
|
||||||
|
|
|
@ -14,83 +14,64 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from kmip.core.factories.payloads import PayloadFactory
|
from kmip.core.factories.payloads import PayloadFactory
|
||||||
|
from kmip.core.messages import payloads
|
||||||
from kmip.core.messages.payloads import activate
|
|
||||||
from kmip.core.messages.payloads import create
|
|
||||||
from kmip.core.messages.payloads import create_key_pair
|
|
||||||
from kmip.core.messages.payloads import decrypt
|
|
||||||
from kmip.core.messages.payloads import destroy
|
|
||||||
from kmip.core.messages.payloads import derive_key
|
|
||||||
from kmip.core.messages.payloads import discover_versions
|
|
||||||
from kmip.core.messages.payloads import encrypt
|
|
||||||
from kmip.core.messages.payloads import get
|
|
||||||
from kmip.core.messages.payloads import get_attribute_list
|
|
||||||
from kmip.core.messages.payloads import get_attributes
|
|
||||||
from kmip.core.messages.payloads import locate
|
|
||||||
from kmip.core.messages.payloads import query
|
|
||||||
from kmip.core.messages.payloads import rekey_key_pair
|
|
||||||
from kmip.core.messages.payloads import register
|
|
||||||
from kmip.core.messages.payloads import revoke
|
|
||||||
from kmip.core.messages.payloads import mac
|
|
||||||
from kmip.core.messages.payloads import sign
|
|
||||||
from kmip.core.messages.payloads import signature_verify
|
|
||||||
|
|
||||||
|
|
||||||
class ResponsePayloadFactory(PayloadFactory):
|
class ResponsePayloadFactory(PayloadFactory):
|
||||||
|
|
||||||
def _create_create_payload(self):
|
def _create_create_payload(self):
|
||||||
return create.CreateResponsePayload()
|
return payloads.CreateResponsePayload()
|
||||||
|
|
||||||
def _create_create_key_pair_payload(self):
|
def _create_create_key_pair_payload(self):
|
||||||
return create_key_pair.CreateKeyPairResponsePayload()
|
return payloads.CreateKeyPairResponsePayload()
|
||||||
|
|
||||||
def _create_register_payload(self):
|
def _create_register_payload(self):
|
||||||
return register.RegisterResponsePayload()
|
return payloads.RegisterResponsePayload()
|
||||||
|
|
||||||
def _create_derive_key_payload(self):
|
def _create_derive_key_payload(self):
|
||||||
return derive_key.DeriveKeyResponsePayload()
|
return payloads.DeriveKeyResponsePayload()
|
||||||
|
|
||||||
def _create_rekey_key_pair_payload(self):
|
def _create_rekey_key_pair_payload(self):
|
||||||
return rekey_key_pair.RekeyKeyPairResponsePayload()
|
return payloads.RekeyKeyPairResponsePayload()
|
||||||
|
|
||||||
def _create_locate_payload(self):
|
def _create_locate_payload(self):
|
||||||
return locate.LocateResponsePayload()
|
return payloads.LocateResponsePayload()
|
||||||
|
|
||||||
def _create_get_payload(self):
|
def _create_get_payload(self):
|
||||||
return get.GetResponsePayload()
|
return payloads.GetResponsePayload()
|
||||||
|
|
||||||
def _create_get_attribute_list_payload(self):
|
def _create_get_attribute_list_payload(self):
|
||||||
return get_attribute_list.GetAttributeListResponsePayload()
|
return payloads.GetAttributeListResponsePayload()
|
||||||
|
|
||||||
def _create_get_attributes_payload(self):
|
def _create_get_attributes_payload(self):
|
||||||
return get_attributes.GetAttributesResponsePayload()
|
return payloads.GetAttributesResponsePayload()
|
||||||
|
|
||||||
def _create_destroy_payload(self):
|
def _create_destroy_payload(self):
|
||||||
return destroy.DestroyResponsePayload()
|
return payloads.DestroyResponsePayload()
|
||||||
|
|
||||||
def _create_query_payload(self):
|
def _create_query_payload(self):
|
||||||
return query.QueryResponsePayload()
|
return payloads.QueryResponsePayload()
|
||||||
|
|
||||||
def _create_discover_versions_payload(self):
|
def _create_discover_versions_payload(self):
|
||||||
return discover_versions.DiscoverVersionsResponsePayload()
|
return payloads.DiscoverVersionsResponsePayload()
|
||||||
|
|
||||||
def _create_activate_payload(self):
|
def _create_activate_payload(self):
|
||||||
return activate.ActivateResponsePayload()
|
return payloads.ActivateResponsePayload()
|
||||||
|
|
||||||
def _create_revoke_payload(self):
|
def _create_revoke_payload(self):
|
||||||
return revoke.RevokeResponsePayload()
|
return payloads.RevokeResponsePayload()
|
||||||
|
|
||||||
def _create_mac_payload(self):
|
def _create_mac_payload(self):
|
||||||
return mac.MACResponsePayload()
|
return payloads.MACResponsePayload()
|
||||||
|
|
||||||
def _create_encrypt_payload(self):
|
def _create_encrypt_payload(self):
|
||||||
return encrypt.EncryptResponsePayload()
|
return payloads.EncryptResponsePayload()
|
||||||
|
|
||||||
def _create_decrypt_payload(self):
|
def _create_decrypt_payload(self):
|
||||||
return decrypt.DecryptResponsePayload()
|
return payloads.DecryptResponsePayload()
|
||||||
|
|
||||||
def _create_sign_payload(self):
|
def _create_sign_payload(self):
|
||||||
return sign.SignResponsePayload()
|
return payloads.SignResponsePayload()
|
||||||
|
|
||||||
def _create_signature_verify_payload(self):
|
def _create_signature_verify_payload(self):
|
||||||
return signature_verify.SignatureVerifyResponsePayload()
|
return payloads.SignatureVerifyResponsePayload()
|
||||||
|
|
|
@ -13,4 +13,121 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
__all__ = ['create', 'destroy', 'get', 'locate', 'register']
|
from kmip.core.messages.payloads.activate import (
|
||||||
|
ActivateRequestPayload,
|
||||||
|
ActivateResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.create import (
|
||||||
|
CreateRequestPayload,
|
||||||
|
CreateResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.create_key_pair import (
|
||||||
|
CreateKeyPairRequestPayload,
|
||||||
|
CreateKeyPairResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.decrypt import (
|
||||||
|
DecryptRequestPayload,
|
||||||
|
DecryptResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.derive_key import (
|
||||||
|
DeriveKeyRequestPayload,
|
||||||
|
DeriveKeyResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.destroy import (
|
||||||
|
DestroyRequestPayload,
|
||||||
|
DestroyResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.discover_versions import (
|
||||||
|
DiscoverVersionsRequestPayload,
|
||||||
|
DiscoverVersionsResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.encrypt import (
|
||||||
|
EncryptRequestPayload,
|
||||||
|
EncryptResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.get import (
|
||||||
|
GetRequestPayload,
|
||||||
|
GetResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.get_attribute_list import (
|
||||||
|
GetAttributeListRequestPayload,
|
||||||
|
GetAttributeListResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.get_attributes import (
|
||||||
|
GetAttributesRequestPayload,
|
||||||
|
GetAttributesResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.locate import (
|
||||||
|
LocateRequestPayload,
|
||||||
|
LocateResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.mac import (
|
||||||
|
MACRequestPayload,
|
||||||
|
MACResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.query import (
|
||||||
|
QueryRequestPayload,
|
||||||
|
QueryResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.register import (
|
||||||
|
RegisterRequestPayload,
|
||||||
|
RegisterResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.rekey_key_pair import (
|
||||||
|
RekeyKeyPairRequestPayload,
|
||||||
|
RekeyKeyPairResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.revoke import (
|
||||||
|
RevokeRequestPayload,
|
||||||
|
RevokeResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.sign import (
|
||||||
|
SignRequestPayload,
|
||||||
|
SignResponsePayload
|
||||||
|
)
|
||||||
|
from kmip.core.messages.payloads.signature_verify import (
|
||||||
|
SignatureVerifyRequestPayload,
|
||||||
|
SignatureVerifyResponsePayload
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"ActivateRequestPayload",
|
||||||
|
"ActivateResponsePayload",
|
||||||
|
"CreateRequestPayload",
|
||||||
|
"CreateResponsePayload",
|
||||||
|
"CreateKeyPairRequestPayload",
|
||||||
|
"CreateKeyPairResponsePayload",
|
||||||
|
"DecryptRequestPayload",
|
||||||
|
"DecryptResponsePayload",
|
||||||
|
"DeriveKeyRequestPayload",
|
||||||
|
"DeriveKeyResponsePayload",
|
||||||
|
"DestroyRequestPayload",
|
||||||
|
"DestroyResponsePayload",
|
||||||
|
"DiscoverVersionsRequestPayload",
|
||||||
|
"DiscoverVersionsResponsePayload",
|
||||||
|
"EncryptRequestPayload",
|
||||||
|
"EncryptResponsePayload",
|
||||||
|
"GetRequestPayload",
|
||||||
|
"GetResponsePayload",
|
||||||
|
"GetAttributeListRequestPayload",
|
||||||
|
"GetAttributeListResponsePayload",
|
||||||
|
"GetAttributesRequestPayload",
|
||||||
|
"GetAttributesResponsePayload",
|
||||||
|
"LocateRequestPayload",
|
||||||
|
"LocateResponsePayload",
|
||||||
|
"MACRequestPayload",
|
||||||
|
"MACResponsePayload",
|
||||||
|
"QueryRequestPayload",
|
||||||
|
"QueryResponsePayload",
|
||||||
|
"RegisterRequestPayload",
|
||||||
|
"RegisterResponsePayload",
|
||||||
|
"RekeyKeyPairRequestPayload",
|
||||||
|
"RekeyKeyPairResponsePayload",
|
||||||
|
"RevokeRequestPayload",
|
||||||
|
"RevokeResponsePayload",
|
||||||
|
"SignRequestPayload",
|
||||||
|
"SignResponsePayload",
|
||||||
|
"SignatureVerifyRequestPayload",
|
||||||
|
"SignatureVerifyResponsePayload"
|
||||||
|
]
|
||||||
|
|
|
@ -48,25 +48,7 @@ from kmip.core.messages.contents import ProtocolVersion
|
||||||
|
|
||||||
from kmip.core.messages import messages
|
from kmip.core.messages import messages
|
||||||
|
|
||||||
from kmip.core.messages.payloads import activate
|
from kmip.core.messages import payloads
|
||||||
from kmip.core.messages.payloads import create
|
|
||||||
from kmip.core.messages.payloads import create_key_pair
|
|
||||||
from kmip.core.messages.payloads import decrypt
|
|
||||||
from kmip.core.messages.payloads import derive_key
|
|
||||||
from kmip.core.messages.payloads import destroy
|
|
||||||
from kmip.core.messages.payloads import discover_versions
|
|
||||||
from kmip.core.messages.payloads import encrypt
|
|
||||||
from kmip.core.messages.payloads import get
|
|
||||||
from kmip.core.messages.payloads import get_attributes
|
|
||||||
from kmip.core.messages.payloads import get_attribute_list
|
|
||||||
from kmip.core.messages.payloads import locate
|
|
||||||
from kmip.core.messages.payloads import query
|
|
||||||
from kmip.core.messages.payloads import rekey_key_pair
|
|
||||||
from kmip.core.messages.payloads import register
|
|
||||||
from kmip.core.messages.payloads import revoke
|
|
||||||
from kmip.core.messages.payloads import sign
|
|
||||||
from kmip.core.messages.payloads import signature_verify
|
|
||||||
from kmip.core.messages.payloads import mac
|
|
||||||
|
|
||||||
from kmip.services.server.kmip_protocol import KMIPProtocol
|
from kmip.services.server.kmip_protocol import KMIPProtocol
|
||||||
|
|
||||||
|
@ -349,7 +331,7 @@ class KMIPProxy(KMIP):
|
||||||
| context for the operation result.
|
| context for the operation result.
|
||||||
"""
|
"""
|
||||||
operation = Operation(OperationEnum.DERIVE_KEY)
|
operation = Operation(OperationEnum.DERIVE_KEY)
|
||||||
request_payload = derive_key.DeriveKeyRequestPayload(
|
request_payload = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=object_type,
|
object_type=object_type,
|
||||||
unique_identifiers=unique_identifiers,
|
unique_identifiers=unique_identifiers,
|
||||||
derivation_method=derivation_method,
|
derivation_method=derivation_method,
|
||||||
|
@ -563,7 +545,7 @@ class KMIPProxy(KMIP):
|
||||||
"""
|
"""
|
||||||
operation = Operation(OperationEnum.ENCRYPT)
|
operation = Operation(OperationEnum.ENCRYPT)
|
||||||
|
|
||||||
request_payload = encrypt.EncryptRequestPayload(
|
request_payload = payloads.EncryptRequestPayload(
|
||||||
unique_identifier=unique_identifier,
|
unique_identifier=unique_identifier,
|
||||||
data=data,
|
data=data,
|
||||||
cryptographic_parameters=cryptographic_parameters,
|
cryptographic_parameters=cryptographic_parameters,
|
||||||
|
@ -639,7 +621,7 @@ class KMIPProxy(KMIP):
|
||||||
"""
|
"""
|
||||||
operation = Operation(OperationEnum.DECRYPT)
|
operation = Operation(OperationEnum.DECRYPT)
|
||||||
|
|
||||||
request_payload = decrypt.DecryptRequestPayload(
|
request_payload = payloads.DecryptRequestPayload(
|
||||||
unique_identifier=unique_identifier,
|
unique_identifier=unique_identifier,
|
||||||
data=data,
|
data=data,
|
||||||
cryptographic_parameters=cryptographic_parameters,
|
cryptographic_parameters=cryptographic_parameters,
|
||||||
|
@ -714,7 +696,7 @@ class KMIPProxy(KMIP):
|
||||||
"""
|
"""
|
||||||
operation = Operation(OperationEnum.SIGNATURE_VERIFY)
|
operation = Operation(OperationEnum.SIGNATURE_VERIFY)
|
||||||
|
|
||||||
request_payload = signature_verify.SignatureVerifyRequestPayload(
|
request_payload = payloads.SignatureVerifyRequestPayload(
|
||||||
unique_identifier=unique_identifier,
|
unique_identifier=unique_identifier,
|
||||||
cryptographic_parameters=cryptographic_parameters,
|
cryptographic_parameters=cryptographic_parameters,
|
||||||
data=message,
|
data=message,
|
||||||
|
@ -781,7 +763,7 @@ class KMIPProxy(KMIP):
|
||||||
"""
|
"""
|
||||||
operation = Operation(OperationEnum.SIGN)
|
operation = Operation(OperationEnum.SIGN)
|
||||||
|
|
||||||
request_payload = sign.SignRequestPayload(
|
request_payload = payloads.SignRequestPayload(
|
||||||
unique_identifier=unique_identifier,
|
unique_identifier=unique_identifier,
|
||||||
cryptographic_parameters=cryptographic_parameters,
|
cryptographic_parameters=cryptographic_parameters,
|
||||||
data=data
|
data=data
|
||||||
|
@ -831,7 +813,7 @@ class KMIPProxy(KMIP):
|
||||||
if object_type is None:
|
if object_type is None:
|
||||||
raise ValueError('object_type cannot be None')
|
raise ValueError('object_type cannot be None')
|
||||||
|
|
||||||
req_pl = create.CreateRequestPayload(
|
req_pl = payloads.CreateRequestPayload(
|
||||||
object_type=object_type,
|
object_type=object_type,
|
||||||
template_attribute=template_attribute)
|
template_attribute=template_attribute)
|
||||||
batch_item = messages.RequestBatchItem(operation=operation,
|
batch_item = messages.RequestBatchItem(operation=operation,
|
||||||
|
@ -867,7 +849,7 @@ class KMIPProxy(KMIP):
|
||||||
private_key_template_attribute=None,
|
private_key_template_attribute=None,
|
||||||
public_key_template_attribute=None):
|
public_key_template_attribute=None):
|
||||||
operation = Operation(OperationEnum.CREATE_KEY_PAIR)
|
operation = Operation(OperationEnum.CREATE_KEY_PAIR)
|
||||||
payload = create_key_pair.CreateKeyPairRequestPayload(
|
payload = payloads.CreateKeyPairRequestPayload(
|
||||||
common_template_attribute=common_template_attribute,
|
common_template_attribute=common_template_attribute,
|
||||||
private_key_template_attribute=private_key_template_attribute,
|
private_key_template_attribute=private_key_template_attribute,
|
||||||
public_key_template_attribute=public_key_template_attribute)
|
public_key_template_attribute=public_key_template_attribute)
|
||||||
|
@ -881,7 +863,7 @@ class KMIPProxy(KMIP):
|
||||||
private_key_template_attribute=None,
|
private_key_template_attribute=None,
|
||||||
public_key_template_attribute=None):
|
public_key_template_attribute=None):
|
||||||
operation = Operation(OperationEnum.REKEY_KEY_PAIR)
|
operation = Operation(OperationEnum.REKEY_KEY_PAIR)
|
||||||
payload = rekey_key_pair.RekeyKeyPairRequestPayload(
|
payload = payloads.RekeyKeyPairRequestPayload(
|
||||||
private_key_uuid, offset,
|
private_key_uuid, offset,
|
||||||
common_template_attribute=common_template_attribute,
|
common_template_attribute=common_template_attribute,
|
||||||
private_key_template_attribute=private_key_template_attribute,
|
private_key_template_attribute=private_key_template_attribute,
|
||||||
|
@ -892,7 +874,7 @@ class KMIPProxy(KMIP):
|
||||||
|
|
||||||
def _build_query_batch_item(self, query_functions=None):
|
def _build_query_batch_item(self, query_functions=None):
|
||||||
operation = Operation(OperationEnum.QUERY)
|
operation = Operation(OperationEnum.QUERY)
|
||||||
payload = query.QueryRequestPayload(query_functions)
|
payload = payloads.QueryRequestPayload(query_functions)
|
||||||
batch_item = messages.RequestBatchItem(
|
batch_item = messages.RequestBatchItem(
|
||||||
operation=operation, request_payload=payload)
|
operation=operation, request_payload=payload)
|
||||||
return batch_item
|
return batch_item
|
||||||
|
@ -903,7 +885,7 @@ class KMIPProxy(KMIP):
|
||||||
attribute_names=None
|
attribute_names=None
|
||||||
):
|
):
|
||||||
operation = Operation(OperationEnum.GET_ATTRIBUTES)
|
operation = Operation(OperationEnum.GET_ATTRIBUTES)
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
uuid,
|
uuid,
|
||||||
attribute_names
|
attribute_names
|
||||||
)
|
)
|
||||||
|
@ -915,7 +897,7 @@ class KMIPProxy(KMIP):
|
||||||
|
|
||||||
def _build_get_attribute_list_batch_item(self, uid=None):
|
def _build_get_attribute_list_batch_item(self, uid=None):
|
||||||
operation = Operation(OperationEnum.GET_ATTRIBUTE_LIST)
|
operation = Operation(OperationEnum.GET_ATTRIBUTE_LIST)
|
||||||
payload = get_attribute_list.GetAttributeListRequestPayload(uid)
|
payload = payloads.GetAttributeListRequestPayload(uid)
|
||||||
batch_item = messages.RequestBatchItem(
|
batch_item = messages.RequestBatchItem(
|
||||||
operation=operation, request_payload=payload)
|
operation=operation, request_payload=payload)
|
||||||
return batch_item
|
return batch_item
|
||||||
|
@ -923,7 +905,7 @@ class KMIPProxy(KMIP):
|
||||||
def _build_discover_versions_batch_item(self, protocol_versions=None):
|
def _build_discover_versions_batch_item(self, protocol_versions=None):
|
||||||
operation = Operation(OperationEnum.DISCOVER_VERSIONS)
|
operation = Operation(OperationEnum.DISCOVER_VERSIONS)
|
||||||
|
|
||||||
payload = discover_versions.DiscoverVersionsRequestPayload(
|
payload = payloads.DiscoverVersionsRequestPayload(
|
||||||
protocol_versions)
|
protocol_versions)
|
||||||
|
|
||||||
batch_item = messages.RequestBatchItem(
|
batch_item = messages.RequestBatchItem(
|
||||||
|
@ -1084,7 +1066,7 @@ class KMIPProxy(KMIP):
|
||||||
if key_wrapping_specification is not None:
|
if key_wrapping_specification is not None:
|
||||||
kws = objects.KeyWrappingSpecification(key_wrapping_specification)
|
kws = objects.KeyWrappingSpecification(key_wrapping_specification)
|
||||||
|
|
||||||
req_pl = get.GetRequestPayload(
|
req_pl = payloads.GetRequestPayload(
|
||||||
unique_identifier=unique_identifier,
|
unique_identifier=unique_identifier,
|
||||||
key_format_type=key_format_type,
|
key_format_type=key_format_type,
|
||||||
key_compression_type=key_compression_type,
|
key_compression_type=key_compression_type,
|
||||||
|
@ -1126,7 +1108,7 @@ class KMIPProxy(KMIP):
|
||||||
if unique_identifier is not None:
|
if unique_identifier is not None:
|
||||||
uuid = attr.UniqueIdentifier(unique_identifier)
|
uuid = attr.UniqueIdentifier(unique_identifier)
|
||||||
|
|
||||||
payload = activate.ActivateRequestPayload(unique_identifier=uuid)
|
payload = payloads.ActivateRequestPayload(unique_identifier=uuid)
|
||||||
|
|
||||||
batch_item = messages.RequestBatchItem(operation=operation,
|
batch_item = messages.RequestBatchItem(operation=operation,
|
||||||
request_payload=payload)
|
request_payload=payload)
|
||||||
|
@ -1159,7 +1141,7 @@ class KMIPProxy(KMIP):
|
||||||
if unique_identifier is not None:
|
if unique_identifier is not None:
|
||||||
uuid = attr.UniqueIdentifier(unique_identifier)
|
uuid = attr.UniqueIdentifier(unique_identifier)
|
||||||
|
|
||||||
payload = destroy.DestroyRequestPayload(unique_identifier=uuid)
|
payload = payloads.DestroyRequestPayload(unique_identifier=uuid)
|
||||||
|
|
||||||
batch_item = messages.RequestBatchItem(operation=operation,
|
batch_item = messages.RequestBatchItem(operation=operation,
|
||||||
request_payload=payload)
|
request_payload=payload)
|
||||||
|
@ -1194,7 +1176,7 @@ class KMIPProxy(KMIP):
|
||||||
if unique_identifier is not None:
|
if unique_identifier is not None:
|
||||||
uuid = attr.UniqueIdentifier(unique_identifier)
|
uuid = attr.UniqueIdentifier(unique_identifier)
|
||||||
|
|
||||||
payload = revoke.RevokeRequestPayload(
|
payload = payloads.RevokeRequestPayload(
|
||||||
unique_identifier=uuid,
|
unique_identifier=uuid,
|
||||||
revocation_reason=reason,
|
revocation_reason=reason,
|
||||||
compromise_occurrence_date=compromise_occurrence_date)
|
compromise_occurrence_date=compromise_occurrence_date)
|
||||||
|
@ -1231,7 +1213,7 @@ class KMIPProxy(KMIP):
|
||||||
if object_type is None:
|
if object_type is None:
|
||||||
raise ValueError('object_type cannot be None')
|
raise ValueError('object_type cannot be None')
|
||||||
|
|
||||||
req_pl = register.RegisterRequestPayload(
|
req_pl = payloads.RegisterRequestPayload(
|
||||||
object_type=object_type,
|
object_type=object_type,
|
||||||
template_attribute=template_attribute,
|
template_attribute=template_attribute,
|
||||||
secret=secret)
|
secret=secret)
|
||||||
|
@ -1271,18 +1253,18 @@ class KMIPProxy(KMIP):
|
||||||
objgrp = None
|
objgrp = None
|
||||||
|
|
||||||
if maximum_items is not None:
|
if maximum_items is not None:
|
||||||
mxi = locate.LocateRequestPayload.MaximumItems(maximum_items)
|
mxi = payloads.LocateRequestPayload.MaximumItems(maximum_items)
|
||||||
if storage_status_mask is not None:
|
if storage_status_mask is not None:
|
||||||
m = storage_status_mask
|
m = storage_status_mask
|
||||||
ssmask = locate.LocateRequestPayload.StorageStatusMask(m)
|
ssmask = payloads.LocateRequestPayload.StorageStatusMask(m)
|
||||||
if object_group_member is not None:
|
if object_group_member is not None:
|
||||||
o = object_group_member
|
o = object_group_member
|
||||||
objgrp = locate.LocateRequestPayload.ObjectGroupMember(o)
|
objgrp = payloads.LocateRequestPayload.ObjectGroupMember(o)
|
||||||
|
|
||||||
payload = locate.LocateRequestPayload(maximum_items=mxi,
|
payload = payloads.LocateRequestPayload(maximum_items=mxi,
|
||||||
storage_status_mask=ssmask,
|
storage_status_mask=ssmask,
|
||||||
object_group_member=objgrp,
|
object_group_member=objgrp,
|
||||||
attributes=attributes)
|
attributes=attributes)
|
||||||
|
|
||||||
batch_item = messages.RequestBatchItem(operation=operation,
|
batch_item = messages.RequestBatchItem(operation=operation,
|
||||||
request_payload=payload)
|
request_payload=payload)
|
||||||
|
@ -1315,7 +1297,7 @@ class KMIPProxy(KMIP):
|
||||||
credential=None):
|
credential=None):
|
||||||
operation = Operation(OperationEnum.MAC)
|
operation = Operation(OperationEnum.MAC)
|
||||||
|
|
||||||
req_pl = mac.MACRequestPayload(
|
req_pl = payloads.MACRequestPayload(
|
||||||
unique_identifier=attr.UniqueIdentifier(unique_identifier),
|
unique_identifier=attr.UniqueIdentifier(unique_identifier),
|
||||||
cryptographic_parameters=cryptographic_parameters,
|
cryptographic_parameters=cryptographic_parameters,
|
||||||
data=objects.Data(data))
|
data=objects.Data(data))
|
||||||
|
|
|
@ -38,24 +38,7 @@ from kmip.core.factories import secrets
|
||||||
from kmip.core.messages import contents
|
from kmip.core.messages import contents
|
||||||
from kmip.core.messages import messages
|
from kmip.core.messages import messages
|
||||||
|
|
||||||
from kmip.core.messages.payloads import activate
|
from kmip.core.messages import payloads
|
||||||
from kmip.core.messages.payloads import revoke
|
|
||||||
from kmip.core.messages.payloads import create
|
|
||||||
from kmip.core.messages.payloads import create_key_pair
|
|
||||||
from kmip.core.messages.payloads import decrypt
|
|
||||||
from kmip.core.messages.payloads import derive_key
|
|
||||||
from kmip.core.messages.payloads import destroy
|
|
||||||
from kmip.core.messages.payloads import discover_versions
|
|
||||||
from kmip.core.messages.payloads import encrypt
|
|
||||||
from kmip.core.messages.payloads import get
|
|
||||||
from kmip.core.messages.payloads import get_attributes
|
|
||||||
from kmip.core.messages.payloads import get_attribute_list
|
|
||||||
from kmip.core.messages.payloads import query
|
|
||||||
from kmip.core.messages.payloads import register
|
|
||||||
from kmip.core.messages.payloads import mac
|
|
||||||
from kmip.core.messages.payloads import locate
|
|
||||||
from kmip.core.messages.payloads import sign
|
|
||||||
from kmip.core.messages.payloads import signature_verify
|
|
||||||
|
|
||||||
from kmip.core import misc
|
from kmip.core import misc
|
||||||
|
|
||||||
|
@ -1086,7 +1069,7 @@ class KmipEngine(object):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
response_payload = create.CreateResponsePayload(
|
response_payload = payloads.CreateResponsePayload(
|
||||||
object_type=payload.object_type,
|
object_type=payload.object_type,
|
||||||
unique_identifier=attributes.UniqueIdentifier(
|
unique_identifier=attributes.UniqueIdentifier(
|
||||||
str(managed_object.unique_identifier)
|
str(managed_object.unique_identifier)
|
||||||
|
@ -1262,7 +1245,7 @@ class KmipEngine(object):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
response_payload = create_key_pair.CreateKeyPairResponsePayload(
|
response_payload = payloads.CreateKeyPairResponsePayload(
|
||||||
private_key_uuid=attributes.PrivateKeyUniqueIdentifier(
|
private_key_uuid=attributes.PrivateKeyUniqueIdentifier(
|
||||||
str(private_key.unique_identifier)
|
str(private_key.unique_identifier)
|
||||||
),
|
),
|
||||||
|
@ -1332,7 +1315,7 @@ class KmipEngine(object):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
response_payload = register.RegisterResponsePayload(
|
response_payload = payloads.RegisterResponsePayload(
|
||||||
unique_identifier=attributes.UniqueIdentifier(
|
unique_identifier=attributes.UniqueIdentifier(
|
||||||
str(managed_object.unique_identifier)
|
str(managed_object.unique_identifier)
|
||||||
)
|
)
|
||||||
|
@ -1521,7 +1504,7 @@ class KmipEngine(object):
|
||||||
)
|
)
|
||||||
self._id_placeholder = str(managed_object.unique_identifier)
|
self._id_placeholder = str(managed_object.unique_identifier)
|
||||||
|
|
||||||
response_payload = derive_key.DeriveKeyResponsePayload(
|
response_payload = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier=str(managed_object.unique_identifier)
|
unique_identifier=str(managed_object.unique_identifier)
|
||||||
)
|
)
|
||||||
return response_payload
|
return response_payload
|
||||||
|
@ -1562,7 +1545,7 @@ class KmipEngine(object):
|
||||||
str(managed_object.unique_identifier))
|
str(managed_object.unique_identifier))
|
||||||
for managed_object in managed_objects]
|
for managed_object in managed_objects]
|
||||||
|
|
||||||
response_payload = locate.LocateResponsePayload(
|
response_payload = payloads.LocateResponsePayload(
|
||||||
unique_identifiers=unique_identifiers
|
unique_identifiers=unique_identifiers
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1716,7 +1699,7 @@ class KmipEngine(object):
|
||||||
else:
|
else:
|
||||||
core_secret = self._build_core_object(managed_object)
|
core_secret = self._build_core_object(managed_object)
|
||||||
|
|
||||||
response_payload = get.GetResponsePayload(
|
response_payload = payloads.GetResponsePayload(
|
||||||
object_type=managed_object._object_type,
|
object_type=managed_object._object_type,
|
||||||
unique_identifier=unique_identifier,
|
unique_identifier=unique_identifier,
|
||||||
secret=core_secret
|
secret=core_secret
|
||||||
|
@ -1742,7 +1725,7 @@ class KmipEngine(object):
|
||||||
payload.attribute_names
|
payload.attribute_names
|
||||||
)
|
)
|
||||||
|
|
||||||
response_payload = get_attributes.GetAttributesResponsePayload(
|
response_payload = payloads.GetAttributesResponsePayload(
|
||||||
unique_identifier=unique_identifier,
|
unique_identifier=unique_identifier,
|
||||||
attributes=attrs
|
attributes=attrs
|
||||||
)
|
)
|
||||||
|
@ -1771,7 +1754,7 @@ class KmipEngine(object):
|
||||||
for object_attribute in object_attributes:
|
for object_attribute in object_attributes:
|
||||||
attribute_names.append(object_attribute.attribute_name.value)
|
attribute_names.append(object_attribute.attribute_name.value)
|
||||||
|
|
||||||
response_payload = get_attribute_list.GetAttributeListResponsePayload(
|
response_payload = payloads.GetAttributeListResponsePayload(
|
||||||
unique_identifier=unique_identifier,
|
unique_identifier=unique_identifier,
|
||||||
attribute_names=attribute_names
|
attribute_names=attribute_names
|
||||||
)
|
)
|
||||||
|
@ -1809,7 +1792,7 @@ class KmipEngine(object):
|
||||||
managed_object.state = enums.State.ACTIVE
|
managed_object.state = enums.State.ACTIVE
|
||||||
self._data_session.commit()
|
self._data_session.commit()
|
||||||
|
|
||||||
response_payload = activate.ActivateResponsePayload(
|
response_payload = payloads.ActivateResponsePayload(
|
||||||
unique_identifier=attributes.UniqueIdentifier(unique_identifier)
|
unique_identifier=attributes.UniqueIdentifier(unique_identifier)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1864,7 +1847,7 @@ class KmipEngine(object):
|
||||||
managed_object.state = enums.State.DEACTIVATED
|
managed_object.state = enums.State.DEACTIVATED
|
||||||
self._data_session.commit()
|
self._data_session.commit()
|
||||||
|
|
||||||
response_payload = revoke.RevokeResponsePayload(
|
response_payload = payloads.RevokeResponsePayload(
|
||||||
unique_identifier=attributes.UniqueIdentifier(unique_identifier)
|
unique_identifier=attributes.UniqueIdentifier(unique_identifier)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1904,7 +1887,7 @@ class KmipEngine(object):
|
||||||
objects.ManagedObject.unique_identifier == unique_identifier
|
objects.ManagedObject.unique_identifier == unique_identifier
|
||||||
).delete()
|
).delete()
|
||||||
|
|
||||||
response_payload = destroy.DestroyResponsePayload(
|
response_payload = payloads.DestroyResponsePayload(
|
||||||
unique_identifier=attributes.UniqueIdentifier(unique_identifier)
|
unique_identifier=attributes.UniqueIdentifier(unique_identifier)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1968,7 +1951,7 @@ class KmipEngine(object):
|
||||||
if enums.QueryFunction.QUERY_EXTENSION_MAP in queries:
|
if enums.QueryFunction.QUERY_EXTENSION_MAP in queries:
|
||||||
extensions = list()
|
extensions = list()
|
||||||
|
|
||||||
response_payload = query.QueryResponsePayload(
|
response_payload = payloads.QueryResponsePayload(
|
||||||
operations=operations,
|
operations=operations,
|
||||||
object_types=objects,
|
object_types=objects,
|
||||||
vendor_identification=vendor_identification,
|
vendor_identification=vendor_identification,
|
||||||
|
@ -1991,7 +1974,7 @@ class KmipEngine(object):
|
||||||
else:
|
else:
|
||||||
supported_versions = self._protocol_versions
|
supported_versions = self._protocol_versions
|
||||||
|
|
||||||
response_payload = discover_versions.DiscoverVersionsResponsePayload(
|
response_payload = payloads.DiscoverVersionsResponsePayload(
|
||||||
protocol_versions=supported_versions
|
protocol_versions=supported_versions
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2053,7 +2036,7 @@ class KmipEngine(object):
|
||||||
iv_nonce=payload.iv_counter_nonce
|
iv_nonce=payload.iv_counter_nonce
|
||||||
)
|
)
|
||||||
|
|
||||||
response_payload = encrypt.EncryptResponsePayload(
|
response_payload = payloads.EncryptResponsePayload(
|
||||||
unique_identifier,
|
unique_identifier,
|
||||||
result.get('cipher_text'),
|
result.get('cipher_text'),
|
||||||
result.get('iv_nonce')
|
result.get('iv_nonce')
|
||||||
|
@ -2116,7 +2099,7 @@ class KmipEngine(object):
|
||||||
iv_nonce=payload.iv_counter_nonce
|
iv_nonce=payload.iv_counter_nonce
|
||||||
)
|
)
|
||||||
|
|
||||||
response_payload = decrypt.DecryptResponsePayload(
|
response_payload = payloads.DecryptResponsePayload(
|
||||||
unique_identifier,
|
unique_identifier,
|
||||||
result
|
result
|
||||||
)
|
)
|
||||||
|
@ -2184,7 +2167,7 @@ class KmipEngine(object):
|
||||||
else:
|
else:
|
||||||
validity = enums.ValidityIndicator.INVALID
|
validity = enums.ValidityIndicator.INVALID
|
||||||
|
|
||||||
response_payload = signature_verify.SignatureVerifyResponsePayload(
|
response_payload = payloads.SignatureVerifyResponsePayload(
|
||||||
unique_identifier=unique_identifier,
|
unique_identifier=unique_identifier,
|
||||||
validity_indicator=validity
|
validity_indicator=validity
|
||||||
)
|
)
|
||||||
|
@ -2256,7 +2239,7 @@ class KmipEngine(object):
|
||||||
data
|
data
|
||||||
)
|
)
|
||||||
|
|
||||||
response_payload = mac.MACResponsePayload(
|
response_payload = payloads.MACResponsePayload(
|
||||||
unique_identifier=attributes.UniqueIdentifier(unique_identifier),
|
unique_identifier=attributes.UniqueIdentifier(unique_identifier),
|
||||||
mac_data=MACData(result)
|
mac_data=MACData(result)
|
||||||
)
|
)
|
||||||
|
@ -2312,7 +2295,7 @@ class KmipEngine(object):
|
||||||
data=payload.data
|
data=payload.data
|
||||||
)
|
)
|
||||||
|
|
||||||
response_payload = sign.SignResponsePayload(
|
response_payload = payloads.SignResponsePayload(
|
||||||
unique_identifier=unique_identifier,
|
unique_identifier=unique_identifier,
|
||||||
signature_data=result
|
signature_data=result
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,25 +18,7 @@ import testtools
|
||||||
from kmip.core import enums
|
from kmip.core import enums
|
||||||
from kmip.core.factories.payloads.request import RequestPayloadFactory
|
from kmip.core.factories.payloads.request import RequestPayloadFactory
|
||||||
|
|
||||||
from kmip.core.messages.payloads import activate
|
from kmip.core.messages import payloads
|
||||||
from kmip.core.messages.payloads import create
|
|
||||||
from kmip.core.messages.payloads import create_key_pair
|
|
||||||
from kmip.core.messages.payloads import decrypt
|
|
||||||
from kmip.core.messages.payloads import destroy
|
|
||||||
from kmip.core.messages.payloads import derive_key
|
|
||||||
from kmip.core.messages.payloads import discover_versions
|
|
||||||
from kmip.core.messages.payloads import encrypt
|
|
||||||
from kmip.core.messages.payloads import get
|
|
||||||
from kmip.core.messages.payloads import get_attribute_list
|
|
||||||
from kmip.core.messages.payloads import get_attributes
|
|
||||||
from kmip.core.messages.payloads import locate
|
|
||||||
from kmip.core.messages.payloads import query
|
|
||||||
from kmip.core.messages.payloads import rekey_key_pair
|
|
||||||
from kmip.core.messages.payloads import register
|
|
||||||
from kmip.core.messages.payloads import revoke
|
|
||||||
from kmip.core.messages.payloads import sign
|
|
||||||
from kmip.core.messages.payloads import signature_verify
|
|
||||||
from kmip.core.messages.payloads import mac
|
|
||||||
|
|
||||||
|
|
||||||
class TestRequestPayloadFactory(testtools.TestCase):
|
class TestRequestPayloadFactory(testtools.TestCase):
|
||||||
|
@ -57,25 +39,25 @@ class TestRequestPayloadFactory(testtools.TestCase):
|
||||||
|
|
||||||
def test_create_create_payload(self):
|
def test_create_create_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.CREATE)
|
payload = self.factory.create(enums.Operation.CREATE)
|
||||||
self._test_payload_type(payload, create.CreateRequestPayload)
|
self._test_payload_type(payload, payloads.CreateRequestPayload)
|
||||||
|
|
||||||
def test_create_create_key_pair_payload(self):
|
def test_create_create_key_pair_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.CREATE_KEY_PAIR)
|
payload = self.factory.create(enums.Operation.CREATE_KEY_PAIR)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
create_key_pair.CreateKeyPairRequestPayload
|
payloads.CreateKeyPairRequestPayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_register_payload(self):
|
def test_create_register_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.REGISTER)
|
payload = self.factory.create(enums.Operation.REGISTER)
|
||||||
self._test_payload_type(payload, register.RegisterRequestPayload)
|
self._test_payload_type(payload, payloads.RegisterRequestPayload)
|
||||||
|
|
||||||
def test_create_rekey_payload(self):
|
def test_create_rekey_payload(self):
|
||||||
self._test_not_implemented(self.factory.create, enums.Operation.REKEY)
|
self._test_not_implemented(self.factory.create, enums.Operation.REKEY)
|
||||||
|
|
||||||
def test_create_derive_key_payload(self):
|
def test_create_derive_key_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.DERIVE_KEY)
|
payload = self.factory.create(enums.Operation.DERIVE_KEY)
|
||||||
self._test_payload_type(payload, derive_key.DeriveKeyRequestPayload)
|
self._test_payload_type(payload, payloads.DeriveKeyRequestPayload)
|
||||||
|
|
||||||
def test_create_certify_payload(self):
|
def test_create_certify_payload(self):
|
||||||
self._test_not_implemented(
|
self._test_not_implemented(
|
||||||
|
@ -91,27 +73,27 @@ class TestRequestPayloadFactory(testtools.TestCase):
|
||||||
|
|
||||||
def test_create_locate_payload(self):
|
def test_create_locate_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.LOCATE)
|
payload = self.factory.create(enums.Operation.LOCATE)
|
||||||
self._test_payload_type(payload, locate.LocateRequestPayload)
|
self._test_payload_type(payload, payloads.LocateRequestPayload)
|
||||||
|
|
||||||
def test_create_check_payload(self):
|
def test_create_check_payload(self):
|
||||||
self._test_not_implemented(self.factory.create, enums.Operation.CHECK)
|
self._test_not_implemented(self.factory.create, enums.Operation.CHECK)
|
||||||
|
|
||||||
def test_create_get_payload(self):
|
def test_create_get_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.GET)
|
payload = self.factory.create(enums.Operation.GET)
|
||||||
self._test_payload_type(payload, get.GetRequestPayload)
|
self._test_payload_type(payload, payloads.GetRequestPayload)
|
||||||
|
|
||||||
def test_create_get_attributes_payload(self):
|
def test_create_get_attributes_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.GET_ATTRIBUTES)
|
payload = self.factory.create(enums.Operation.GET_ATTRIBUTES)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
get_attributes.GetAttributesRequestPayload
|
payloads.GetAttributesRequestPayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_get_attributes_list_payload(self):
|
def test_create_get_attributes_list_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.GET_ATTRIBUTE_LIST)
|
payload = self.factory.create(enums.Operation.GET_ATTRIBUTE_LIST)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
get_attribute_list.GetAttributeListRequestPayload
|
payloads.GetAttributeListRequestPayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_add_attribute_payload(self):
|
def test_create_add_attribute_payload(self):
|
||||||
|
@ -146,15 +128,15 @@ class TestRequestPayloadFactory(testtools.TestCase):
|
||||||
|
|
||||||
def test_create_activate_payload(self):
|
def test_create_activate_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.ACTIVATE)
|
payload = self.factory.create(enums.Operation.ACTIVATE)
|
||||||
self._test_payload_type(payload, activate.ActivateRequestPayload)
|
self._test_payload_type(payload, payloads.ActivateRequestPayload)
|
||||||
|
|
||||||
def test_create_revoke_payload(self):
|
def test_create_revoke_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.REVOKE)
|
payload = self.factory.create(enums.Operation.REVOKE)
|
||||||
self._test_payload_type(payload, revoke.RevokeRequestPayload)
|
self._test_payload_type(payload, payloads.RevokeRequestPayload)
|
||||||
|
|
||||||
def test_create_destroy_payload(self):
|
def test_create_destroy_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.DESTROY)
|
payload = self.factory.create(enums.Operation.DESTROY)
|
||||||
self._test_payload_type(payload, destroy.DestroyRequestPayload)
|
self._test_payload_type(payload, payloads.DestroyRequestPayload)
|
||||||
|
|
||||||
def test_create_archive_payload(self):
|
def test_create_archive_payload(self):
|
||||||
self._test_not_implemented(
|
self._test_not_implemented(
|
||||||
|
@ -176,7 +158,7 @@ class TestRequestPayloadFactory(testtools.TestCase):
|
||||||
|
|
||||||
def test_create_query_payload(self):
|
def test_create_query_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.QUERY)
|
payload = self.factory.create(enums.Operation.QUERY)
|
||||||
self._test_payload_type(payload, query.QueryRequestPayload)
|
self._test_payload_type(payload, payloads.QueryRequestPayload)
|
||||||
|
|
||||||
def test_create_cancel_payload(self):
|
def test_create_cancel_payload(self):
|
||||||
self._test_not_implemented(
|
self._test_not_implemented(
|
||||||
|
@ -200,38 +182,38 @@ class TestRequestPayloadFactory(testtools.TestCase):
|
||||||
payload = self.factory.create(enums.Operation.REKEY_KEY_PAIR)
|
payload = self.factory.create(enums.Operation.REKEY_KEY_PAIR)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
rekey_key_pair.RekeyKeyPairRequestPayload
|
payloads.RekeyKeyPairRequestPayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_discover_versions_payload(self):
|
def test_create_discover_versions_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.DISCOVER_VERSIONS)
|
payload = self.factory.create(enums.Operation.DISCOVER_VERSIONS)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
discover_versions.DiscoverVersionsRequestPayload
|
payloads.DiscoverVersionsRequestPayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_encrypt_payload(self):
|
def test_create_encrypt_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.ENCRYPT)
|
payload = self.factory.create(enums.Operation.ENCRYPT)
|
||||||
self._test_payload_type(payload, encrypt.EncryptRequestPayload)
|
self._test_payload_type(payload, payloads.EncryptRequestPayload)
|
||||||
|
|
||||||
def test_create_decrypt_payload(self):
|
def test_create_decrypt_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.DECRYPT)
|
payload = self.factory.create(enums.Operation.DECRYPT)
|
||||||
self._test_payload_type(payload, decrypt.DecryptRequestPayload)
|
self._test_payload_type(payload, payloads.DecryptRequestPayload)
|
||||||
|
|
||||||
def test_create_sign_payload(self):
|
def test_create_sign_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.SIGN)
|
payload = self.factory.create(enums.Operation.SIGN)
|
||||||
self._test_payload_type(payload, sign.SignRequestPayload)
|
self._test_payload_type(payload, payloads.SignRequestPayload)
|
||||||
|
|
||||||
def test_create_signature_verify_payload(self):
|
def test_create_signature_verify_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.SIGNATURE_VERIFY)
|
payload = self.factory.create(enums.Operation.SIGNATURE_VERIFY)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
signature_verify.SignatureVerifyRequestPayload
|
payloads.SignatureVerifyRequestPayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_mac_payload(self):
|
def test_create_mac_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.MAC)
|
payload = self.factory.create(enums.Operation.MAC)
|
||||||
self._test_payload_type(payload, mac.MACRequestPayload)
|
self._test_payload_type(payload, payloads.MACRequestPayload)
|
||||||
|
|
||||||
def test_create_mac_verify_payload(self):
|
def test_create_mac_verify_payload(self):
|
||||||
self._test_not_implemented(
|
self._test_not_implemented(
|
||||||
|
|
|
@ -18,25 +18,7 @@ import testtools
|
||||||
from kmip.core import enums
|
from kmip.core import enums
|
||||||
from kmip.core.factories.payloads.response import ResponsePayloadFactory
|
from kmip.core.factories.payloads.response import ResponsePayloadFactory
|
||||||
|
|
||||||
from kmip.core.messages.payloads import activate
|
from kmip.core.messages import payloads
|
||||||
from kmip.core.messages.payloads import create
|
|
||||||
from kmip.core.messages.payloads import create_key_pair
|
|
||||||
from kmip.core.messages.payloads import decrypt
|
|
||||||
from kmip.core.messages.payloads import destroy
|
|
||||||
from kmip.core.messages.payloads import derive_key
|
|
||||||
from kmip.core.messages.payloads import discover_versions
|
|
||||||
from kmip.core.messages.payloads import encrypt
|
|
||||||
from kmip.core.messages.payloads import get
|
|
||||||
from kmip.core.messages.payloads import get_attribute_list
|
|
||||||
from kmip.core.messages.payloads import get_attributes
|
|
||||||
from kmip.core.messages.payloads import locate
|
|
||||||
from kmip.core.messages.payloads import query
|
|
||||||
from kmip.core.messages.payloads import rekey_key_pair
|
|
||||||
from kmip.core.messages.payloads import register
|
|
||||||
from kmip.core.messages.payloads import revoke
|
|
||||||
from kmip.core.messages.payloads import sign
|
|
||||||
from kmip.core.messages.payloads import signature_verify
|
|
||||||
from kmip.core.messages.payloads import mac
|
|
||||||
|
|
||||||
|
|
||||||
class TestResponsePayloadFactory(testtools.TestCase):
|
class TestResponsePayloadFactory(testtools.TestCase):
|
||||||
|
@ -57,25 +39,25 @@ class TestResponsePayloadFactory(testtools.TestCase):
|
||||||
|
|
||||||
def test_create_create_payload(self):
|
def test_create_create_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.CREATE)
|
payload = self.factory.create(enums.Operation.CREATE)
|
||||||
self._test_payload_type(payload, create.CreateResponsePayload)
|
self._test_payload_type(payload, payloads.CreateResponsePayload)
|
||||||
|
|
||||||
def test_create_create_key_pair_payload(self):
|
def test_create_create_key_pair_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.CREATE_KEY_PAIR)
|
payload = self.factory.create(enums.Operation.CREATE_KEY_PAIR)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
create_key_pair.CreateKeyPairResponsePayload
|
payloads.CreateKeyPairResponsePayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_register_payload(self):
|
def test_create_register_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.REGISTER)
|
payload = self.factory.create(enums.Operation.REGISTER)
|
||||||
self._test_payload_type(payload, register.RegisterResponsePayload)
|
self._test_payload_type(payload, payloads.RegisterResponsePayload)
|
||||||
|
|
||||||
def test_create_rekey_payload(self):
|
def test_create_rekey_payload(self):
|
||||||
self._test_not_implemented(self.factory.create, enums.Operation.REKEY)
|
self._test_not_implemented(self.factory.create, enums.Operation.REKEY)
|
||||||
|
|
||||||
def test_create_derive_key_payload(self):
|
def test_create_derive_key_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.DERIVE_KEY)
|
payload = self.factory.create(enums.Operation.DERIVE_KEY)
|
||||||
self._test_payload_type(payload, derive_key.DeriveKeyResponsePayload)
|
self._test_payload_type(payload, payloads.DeriveKeyResponsePayload)
|
||||||
|
|
||||||
def test_create_certify_payload(self):
|
def test_create_certify_payload(self):
|
||||||
self._test_not_implemented(
|
self._test_not_implemented(
|
||||||
|
@ -91,27 +73,27 @@ class TestResponsePayloadFactory(testtools.TestCase):
|
||||||
|
|
||||||
def test_create_locate_payload(self):
|
def test_create_locate_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.LOCATE)
|
payload = self.factory.create(enums.Operation.LOCATE)
|
||||||
self._test_payload_type(payload, locate.LocateResponsePayload)
|
self._test_payload_type(payload, payloads.LocateResponsePayload)
|
||||||
|
|
||||||
def test_create_check_payload(self):
|
def test_create_check_payload(self):
|
||||||
self._test_not_implemented(self.factory.create, enums.Operation.CHECK)
|
self._test_not_implemented(self.factory.create, enums.Operation.CHECK)
|
||||||
|
|
||||||
def test_create_get_payload(self):
|
def test_create_get_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.GET)
|
payload = self.factory.create(enums.Operation.GET)
|
||||||
self._test_payload_type(payload, get.GetResponsePayload)
|
self._test_payload_type(payload, payloads.GetResponsePayload)
|
||||||
|
|
||||||
def test_create_get_attributes_payload(self):
|
def test_create_get_attributes_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.GET_ATTRIBUTES)
|
payload = self.factory.create(enums.Operation.GET_ATTRIBUTES)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
get_attributes.GetAttributesResponsePayload
|
payloads.GetAttributesResponsePayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_get_attributes_list_payload(self):
|
def test_create_get_attributes_list_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.GET_ATTRIBUTE_LIST)
|
payload = self.factory.create(enums.Operation.GET_ATTRIBUTE_LIST)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
get_attribute_list.GetAttributeListResponsePayload
|
payloads.GetAttributeListResponsePayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_add_attribute_payload(self):
|
def test_create_add_attribute_payload(self):
|
||||||
|
@ -144,15 +126,15 @@ class TestResponsePayloadFactory(testtools.TestCase):
|
||||||
|
|
||||||
def test_create_activate_payload(self):
|
def test_create_activate_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.ACTIVATE)
|
payload = self.factory.create(enums.Operation.ACTIVATE)
|
||||||
self._test_payload_type(payload, activate.ActivateResponsePayload)
|
self._test_payload_type(payload, payloads.ActivateResponsePayload)
|
||||||
|
|
||||||
def test_create_revoke_payload(self):
|
def test_create_revoke_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.REVOKE)
|
payload = self.factory.create(enums.Operation.REVOKE)
|
||||||
self._test_payload_type(payload, revoke.RevokeResponsePayload)
|
self._test_payload_type(payload, payloads.RevokeResponsePayload)
|
||||||
|
|
||||||
def test_create_destroy_payload(self):
|
def test_create_destroy_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.DESTROY)
|
payload = self.factory.create(enums.Operation.DESTROY)
|
||||||
self._test_payload_type(payload, destroy.DestroyResponsePayload)
|
self._test_payload_type(payload, payloads.DestroyResponsePayload)
|
||||||
|
|
||||||
def test_create_archive_payload(self):
|
def test_create_archive_payload(self):
|
||||||
self._test_not_implemented(
|
self._test_not_implemented(
|
||||||
|
@ -174,7 +156,7 @@ class TestResponsePayloadFactory(testtools.TestCase):
|
||||||
|
|
||||||
def test_create_query_payload(self):
|
def test_create_query_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.QUERY)
|
payload = self.factory.create(enums.Operation.QUERY)
|
||||||
self._test_payload_type(payload, query.QueryResponsePayload)
|
self._test_payload_type(payload, payloads.QueryResponsePayload)
|
||||||
|
|
||||||
def test_create_cancel_payload(self):
|
def test_create_cancel_payload(self):
|
||||||
self._test_not_implemented(
|
self._test_not_implemented(
|
||||||
|
@ -198,40 +180,40 @@ class TestResponsePayloadFactory(testtools.TestCase):
|
||||||
payload = self.factory.create(enums.Operation.REKEY_KEY_PAIR)
|
payload = self.factory.create(enums.Operation.REKEY_KEY_PAIR)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
rekey_key_pair.RekeyKeyPairResponsePayload
|
payloads.RekeyKeyPairResponsePayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_discover_versions_payload(self):
|
def test_create_discover_versions_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.DISCOVER_VERSIONS)
|
payload = self.factory.create(enums.Operation.DISCOVER_VERSIONS)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
discover_versions.DiscoverVersionsResponsePayload
|
payloads.DiscoverVersionsResponsePayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_encrypt_payload(self):
|
def test_create_encrypt_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.ENCRYPT)
|
payload = self.factory.create(enums.Operation.ENCRYPT)
|
||||||
self._test_payload_type(payload, encrypt.EncryptResponsePayload)
|
self._test_payload_type(payload, payloads.EncryptResponsePayload)
|
||||||
|
|
||||||
def test_create_decrypt_payload(self):
|
def test_create_decrypt_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.DECRYPT)
|
payload = self.factory.create(enums.Operation.DECRYPT)
|
||||||
self._test_payload_type(payload, decrypt.DecryptResponsePayload)
|
self._test_payload_type(payload, payloads.DecryptResponsePayload)
|
||||||
|
|
||||||
def test_create_sign_payload(self):
|
def test_create_sign_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.SIGN)
|
payload = self.factory.create(enums.Operation.SIGN)
|
||||||
self._test_payload_type(payload, sign.SignResponsePayload)
|
self._test_payload_type(payload, payloads.SignResponsePayload)
|
||||||
|
|
||||||
def test_create_signature_verify_payload(self):
|
def test_create_signature_verify_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.SIGNATURE_VERIFY)
|
payload = self.factory.create(enums.Operation.SIGNATURE_VERIFY)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
signature_verify.SignatureVerifyResponsePayload
|
payloads.SignatureVerifyResponsePayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_mac_payload(self):
|
def test_create_mac_payload(self):
|
||||||
payload = self.factory.create(enums.Operation.MAC)
|
payload = self.factory.create(enums.Operation.MAC)
|
||||||
self._test_payload_type(
|
self._test_payload_type(
|
||||||
payload,
|
payload,
|
||||||
mac.MACResponsePayload
|
payloads.MACResponsePayload
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_create_mac_verify_payload(self):
|
def test_create_mac_verify_payload(self):
|
||||||
|
|
|
@ -18,7 +18,7 @@ from testtools import TestCase
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
from kmip.core import attributes
|
from kmip.core import attributes
|
||||||
|
|
||||||
from kmip.core.messages.payloads import activate
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestActivateRequestPayload(TestCase):
|
class TestActivateRequestPayload(TestCase):
|
||||||
|
@ -49,14 +49,14 @@ class TestActivateRequestPayload(TestCase):
|
||||||
Test that a ActivateRequestPayload object can be constructed with no
|
Test that a ActivateRequestPayload object can be constructed with no
|
||||||
specified value.
|
specified value.
|
||||||
"""
|
"""
|
||||||
activate.ActivateRequestPayload()
|
payloads.ActivateRequestPayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
"""
|
"""
|
||||||
Test that a ActivateRequestPayload object can be constructed with valid
|
Test that a ActivateRequestPayload object can be constructed with valid
|
||||||
values.
|
values.
|
||||||
"""
|
"""
|
||||||
activate.ActivateRequestPayload(unique_identifier=self.uuid)
|
payloads.ActivateRequestPayload(unique_identifier=self.uuid)
|
||||||
|
|
||||||
def test_validate_with_bad_uuid_type(self):
|
def test_validate_with_bad_uuid_type(self):
|
||||||
"""
|
"""
|
||||||
|
@ -65,14 +65,14 @@ class TestActivateRequestPayload(TestCase):
|
||||||
"""
|
"""
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid unique identifier",
|
TypeError, "invalid unique identifier",
|
||||||
activate.ActivateRequestPayload, "not-a-uuid")
|
payloads.ActivateRequestPayload, "not-a-uuid")
|
||||||
|
|
||||||
def test_read_with_known_uuid(self):
|
def test_read_with_known_uuid(self):
|
||||||
"""
|
"""
|
||||||
Test that a ActivateRequestPayload object with known UUID can be read
|
Test that a ActivateRequestPayload object with known UUID can be read
|
||||||
from a data stream.
|
from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = activate.ActivateRequestPayload()
|
payload = payloads.ActivateRequestPayload()
|
||||||
payload.read(self.encoding_a)
|
payload.read(self.encoding_a)
|
||||||
expected = '668eff89-3010-4258-bc0e-8c402309c746'
|
expected = '668eff89-3010-4258-bc0e-8c402309c746'
|
||||||
observed = payload.unique_identifier.value
|
observed = payload.unique_identifier.value
|
||||||
|
@ -88,7 +88,7 @@ class TestActivateRequestPayload(TestCase):
|
||||||
written to a data stream.
|
written to a data stream.
|
||||||
"""
|
"""
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = activate.ActivateRequestPayload(self.uuid)
|
payload = payloads.ActivateRequestPayload(self.uuid)
|
||||||
payload.write(stream)
|
payload.write(stream)
|
||||||
|
|
||||||
length_expected = len(self.encoding_a)
|
length_expected = len(self.encoding_a)
|
||||||
|
@ -132,14 +132,14 @@ class TestActivateResponsePayload(TestCase):
|
||||||
Test that a ActivateResponsePayload object can be constructed with no
|
Test that a ActivateResponsePayload object can be constructed with no
|
||||||
specified value.
|
specified value.
|
||||||
"""
|
"""
|
||||||
activate.ActivateResponsePayload()
|
payloads.ActivateResponsePayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
"""
|
"""
|
||||||
Test that a ActivateResponsePayload object can be constructed with
|
Test that a ActivateResponsePayload object can be constructed with
|
||||||
valid values.
|
valid values.
|
||||||
"""
|
"""
|
||||||
activate.ActivateResponsePayload(unique_identifier=self.uuid)
|
payloads.ActivateResponsePayload(unique_identifier=self.uuid)
|
||||||
|
|
||||||
def test_validate_with_invalid_uuid(self):
|
def test_validate_with_invalid_uuid(self):
|
||||||
"""
|
"""
|
||||||
|
@ -148,14 +148,14 @@ class TestActivateResponsePayload(TestCase):
|
||||||
"""
|
"""
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid unique identifier",
|
TypeError, "invalid unique identifier",
|
||||||
activate.ActivateResponsePayload, "not-a-uuid")
|
payloads.ActivateResponsePayload, "not-a-uuid")
|
||||||
|
|
||||||
def test_read_with_known_uuid(self):
|
def test_read_with_known_uuid(self):
|
||||||
"""
|
"""
|
||||||
Test that a ActivateResponsePayload object with known UUID can be read
|
Test that a ActivateResponsePayload object with known UUID can be read
|
||||||
from a data stream.
|
from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = activate.ActivateResponsePayload()
|
payload = payloads.ActivateResponsePayload()
|
||||||
payload.read(self.encoding_a)
|
payload.read(self.encoding_a)
|
||||||
expected = '668eff89-3010-4258-bc0e-8c402309c746'
|
expected = '668eff89-3010-4258-bc0e-8c402309c746'
|
||||||
observed = payload.unique_identifier.value
|
observed = payload.unique_identifier.value
|
||||||
|
@ -171,7 +171,7 @@ class TestActivateResponsePayload(TestCase):
|
||||||
written to a data stream.
|
written to a data stream.
|
||||||
"""
|
"""
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = activate.ActivateResponsePayload(self.uuid)
|
payload = payloads.ActivateResponsePayload(self.uuid)
|
||||||
payload.write(stream)
|
payload.write(stream)
|
||||||
|
|
||||||
length_expected = len(self.encoding_a)
|
length_expected = len(self.encoding_a)
|
||||||
|
|
|
@ -19,7 +19,7 @@ from kmip.core import attributes
|
||||||
from kmip.core import objects
|
from kmip.core import objects
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
|
|
||||||
from kmip.core.messages.payloads import create_key_pair
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestCreateKeyPairRequestPayload(TestCase):
|
class TestCreateKeyPairRequestPayload(TestCase):
|
||||||
|
@ -44,10 +44,10 @@ class TestCreateKeyPairRequestPayload(TestCase):
|
||||||
super(TestCreateKeyPairRequestPayload, self).tearDown()
|
super(TestCreateKeyPairRequestPayload, self).tearDown()
|
||||||
|
|
||||||
def test_init_with_none(self):
|
def test_init_with_none(self):
|
||||||
create_key_pair.CreateKeyPairRequestPayload()
|
payloads.CreateKeyPairRequestPayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
create_key_pair.CreateKeyPairRequestPayload(
|
payloads.CreateKeyPairRequestPayload(
|
||||||
self.common_template_attribute,
|
self.common_template_attribute,
|
||||||
self.private_key_template_attribute,
|
self.private_key_template_attribute,
|
||||||
self.public_key_template_attribute)
|
self.public_key_template_attribute)
|
||||||
|
@ -58,7 +58,7 @@ class TestCreateKeyPairRequestPayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid common template attribute",
|
TypeError, "invalid common template attribute",
|
||||||
create_key_pair.CreateKeyPairRequestPayload, **kwargs)
|
payloads.CreateKeyPairRequestPayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_private_key_template_attribute(self):
|
def test_validate_with_invalid_private_key_template_attribute(self):
|
||||||
kwargs = {'common_template_attribute': None,
|
kwargs = {'common_template_attribute': None,
|
||||||
|
@ -66,7 +66,7 @@ class TestCreateKeyPairRequestPayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid private key template attribute",
|
TypeError, "invalid private key template attribute",
|
||||||
create_key_pair.CreateKeyPairRequestPayload, **kwargs)
|
payloads.CreateKeyPairRequestPayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_public_key_template_attribute(self):
|
def test_validate_with_invalid_public_key_template_attribute(self):
|
||||||
kwargs = {'common_template_attribute': None,
|
kwargs = {'common_template_attribute': None,
|
||||||
|
@ -74,7 +74,7 @@ class TestCreateKeyPairRequestPayload(TestCase):
|
||||||
'public_key_template_attribute': 'invalid'}
|
'public_key_template_attribute': 'invalid'}
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
TypeError, "invalid public key template attribute",
|
TypeError, "invalid public key template attribute",
|
||||||
create_key_pair.CreateKeyPairRequestPayload, **kwargs)
|
payloads.CreateKeyPairRequestPayload, **kwargs)
|
||||||
|
|
||||||
def _test_read(self, stream, payload, common_template_attribute,
|
def _test_read(self, stream, payload, common_template_attribute,
|
||||||
private_key_template_attribute,
|
private_key_template_attribute,
|
||||||
|
@ -103,13 +103,13 @@ class TestCreateKeyPairRequestPayload(TestCase):
|
||||||
|
|
||||||
def test_read_with_none(self):
|
def test_read_with_none(self):
|
||||||
stream = self.encoding_empty
|
stream = self.encoding_empty
|
||||||
payload = create_key_pair.CreateKeyPairRequestPayload()
|
payload = payloads.CreateKeyPairRequestPayload()
|
||||||
|
|
||||||
self._test_read(stream, payload, None, None, None)
|
self._test_read(stream, payload, None, None, None)
|
||||||
|
|
||||||
def test_read_with_args(self):
|
def test_read_with_args(self):
|
||||||
stream = self.encoding_full
|
stream = self.encoding_full
|
||||||
payload = create_key_pair.CreateKeyPairRequestPayload()
|
payload = payloads.CreateKeyPairRequestPayload()
|
||||||
|
|
||||||
self._test_read(stream, payload, self.common_template_attribute,
|
self._test_read(stream, payload, self.common_template_attribute,
|
||||||
self.private_key_template_attribute,
|
self.private_key_template_attribute,
|
||||||
|
@ -133,13 +133,13 @@ class TestCreateKeyPairRequestPayload(TestCase):
|
||||||
|
|
||||||
def test_write_with_none(self):
|
def test_write_with_none(self):
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = create_key_pair.CreateKeyPairRequestPayload()
|
payload = payloads.CreateKeyPairRequestPayload()
|
||||||
|
|
||||||
self._test_write(stream, payload, self.encoding_empty)
|
self._test_write(stream, payload, self.encoding_empty)
|
||||||
|
|
||||||
def test_write_with_args(self):
|
def test_write_with_args(self):
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = create_key_pair.CreateKeyPairRequestPayload(
|
payload = payloads.CreateKeyPairRequestPayload(
|
||||||
self.common_template_attribute,
|
self.common_template_attribute,
|
||||||
self.private_key_template_attribute,
|
self.private_key_template_attribute,
|
||||||
self.public_key_template_attribute)
|
self.public_key_template_attribute)
|
||||||
|
@ -182,10 +182,10 @@ class TestCreateKeyPairResponsePayload(TestCase):
|
||||||
super(TestCreateKeyPairResponsePayload, self).tearDown()
|
super(TestCreateKeyPairResponsePayload, self).tearDown()
|
||||||
|
|
||||||
def test_init_with_none(self):
|
def test_init_with_none(self):
|
||||||
create_key_pair.CreateKeyPairResponsePayload()
|
payloads.CreateKeyPairResponsePayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
create_key_pair.CreateKeyPairResponsePayload(
|
payloads.CreateKeyPairResponsePayload(
|
||||||
self.private_key_uuid, self.public_key_uuid,
|
self.private_key_uuid, self.public_key_uuid,
|
||||||
self.private_key_template_attribute,
|
self.private_key_template_attribute,
|
||||||
self.public_key_template_attribute)
|
self.public_key_template_attribute)
|
||||||
|
@ -197,7 +197,7 @@ class TestCreateKeyPairResponsePayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid private key unique identifier",
|
TypeError, "invalid private key unique identifier",
|
||||||
create_key_pair.CreateKeyPairResponsePayload, **kwargs)
|
payloads.CreateKeyPairResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_public_key_unique_identifier(self):
|
def test_validate_with_invalid_public_key_unique_identifier(self):
|
||||||
kwargs = {'private_key_uuid': None,
|
kwargs = {'private_key_uuid': None,
|
||||||
|
@ -206,7 +206,7 @@ class TestCreateKeyPairResponsePayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid public key unique identifier",
|
TypeError, "invalid public key unique identifier",
|
||||||
create_key_pair.CreateKeyPairResponsePayload, **kwargs)
|
payloads.CreateKeyPairResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_private_key_template_attribute(self):
|
def test_validate_with_invalid_private_key_template_attribute(self):
|
||||||
kwargs = {'private_key_uuid': self.private_key_uuid,
|
kwargs = {'private_key_uuid': self.private_key_uuid,
|
||||||
|
@ -215,7 +215,7 @@ class TestCreateKeyPairResponsePayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid private key template attribute",
|
TypeError, "invalid private key template attribute",
|
||||||
create_key_pair.CreateKeyPairResponsePayload, **kwargs)
|
payloads.CreateKeyPairResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_public_key_template_attribute(self):
|
def test_validate_with_invalid_public_key_template_attribute(self):
|
||||||
kwargs = {'private_key_uuid': self.private_key_uuid,
|
kwargs = {'private_key_uuid': self.private_key_uuid,
|
||||||
|
@ -224,7 +224,7 @@ class TestCreateKeyPairResponsePayload(TestCase):
|
||||||
'public_key_template_attribute': 'invalid'}
|
'public_key_template_attribute': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid public key template attribute",
|
TypeError, "invalid public key template attribute",
|
||||||
create_key_pair.CreateKeyPairResponsePayload, **kwargs)
|
payloads.CreateKeyPairResponsePayload, **kwargs)
|
||||||
|
|
||||||
def _test_read(self, stream, payload, private_key_uuid, public_key_uuid,
|
def _test_read(self, stream, payload, private_key_uuid, public_key_uuid,
|
||||||
private_key_template_attribute,
|
private_key_template_attribute,
|
||||||
|
@ -257,14 +257,14 @@ class TestCreateKeyPairResponsePayload(TestCase):
|
||||||
|
|
||||||
def test_read_with_none(self):
|
def test_read_with_none(self):
|
||||||
stream = self.encoding_empty
|
stream = self.encoding_empty
|
||||||
payload = create_key_pair.CreateKeyPairResponsePayload()
|
payload = payloads.CreateKeyPairResponsePayload()
|
||||||
|
|
||||||
self._test_read(stream, payload, self.empty_private_key_uuid,
|
self._test_read(stream, payload, self.empty_private_key_uuid,
|
||||||
self.empty_public_key_uuid, None, None)
|
self.empty_public_key_uuid, None, None)
|
||||||
|
|
||||||
def test_read_with_args(self):
|
def test_read_with_args(self):
|
||||||
stream = self.encoding_full
|
stream = self.encoding_full
|
||||||
payload = create_key_pair.CreateKeyPairResponsePayload(
|
payload = payloads.CreateKeyPairResponsePayload(
|
||||||
self.private_key_uuid, self.public_key_uuid,
|
self.private_key_uuid, self.public_key_uuid,
|
||||||
self.private_key_template_attribute,
|
self.private_key_template_attribute,
|
||||||
self.public_key_template_attribute)
|
self.public_key_template_attribute)
|
||||||
|
@ -292,13 +292,13 @@ class TestCreateKeyPairResponsePayload(TestCase):
|
||||||
|
|
||||||
def test_write_with_none(self):
|
def test_write_with_none(self):
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = create_key_pair.CreateKeyPairResponsePayload()
|
payload = payloads.CreateKeyPairResponsePayload()
|
||||||
|
|
||||||
self._test_write(stream, payload, self.encoding_empty)
|
self._test_write(stream, payload, self.encoding_empty)
|
||||||
|
|
||||||
def test_write_with_args(self):
|
def test_write_with_args(self):
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = create_key_pair.CreateKeyPairResponsePayload(
|
payload = payloads.CreateKeyPairResponsePayload(
|
||||||
self.private_key_uuid, self.public_key_uuid,
|
self.private_key_uuid, self.public_key_uuid,
|
||||||
self.private_key_template_attribute,
|
self.private_key_template_attribute,
|
||||||
self.public_key_template_attribute)
|
self.public_key_template_attribute)
|
||||||
|
|
|
@ -19,7 +19,7 @@ from kmip.core import attributes
|
||||||
from kmip.core import enums
|
from kmip.core import enums
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
|
|
||||||
from kmip.core.messages.payloads import decrypt
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestDecryptRequestPayload(testtools.TestCase):
|
class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
|
@ -98,7 +98,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that a Decrypt request payload can be constructed with no
|
Test that a Decrypt request payload can be constructed with no
|
||||||
arguments.
|
arguments.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload()
|
payload = payloads.DecryptRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.cryptographic_parameters)
|
self.assertEqual(None, payload.cryptographic_parameters)
|
||||||
|
@ -110,7 +110,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that a Decrypt request payload can be constructed with valid
|
Test that a Decrypt request payload can be constructed with valid
|
||||||
values
|
values
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload(
|
payload = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='00000000-1111-2222-3333-444444444444',
|
unique_identifier='00000000-1111-2222-3333-444444444444',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(),
|
cryptographic_parameters=attributes.CryptographicParameters(),
|
||||||
data=b'\x01\x02\x03',
|
data=b'\x01\x02\x03',
|
||||||
|
@ -133,7 +133,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the unique identifier of a Decrypt request payload.
|
the unique identifier of a Decrypt request payload.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload()
|
payload = payloads.DecryptRequestPayload()
|
||||||
args = (payload, 'unique_identifier', 0)
|
args = (payload, 'unique_identifier', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -147,7 +147,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the cryptographic parameters of a Decrypt request payload.
|
the cryptographic parameters of a Decrypt request payload.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload()
|
payload = payloads.DecryptRequestPayload()
|
||||||
args = (payload, 'cryptographic_parameters', 'invalid')
|
args = (payload, 'cryptographic_parameters', 'invalid')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -162,7 +162,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the data of a Decrypt request payload.
|
the data of a Decrypt request payload.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload()
|
payload = payloads.DecryptRequestPayload()
|
||||||
args = (payload, 'data', 0)
|
args = (payload, 'data', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -176,7 +176,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the IV/counter/nonce of a Decrypt request payload.
|
the IV/counter/nonce of a Decrypt request payload.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload()
|
payload = payloads.DecryptRequestPayload()
|
||||||
args = (payload, 'iv_counter_nonce', 0)
|
args = (payload, 'iv_counter_nonce', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -189,7 +189,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a Decrypt request payload can be read from a data stream.
|
Test that a Decrypt request payload can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload()
|
payload = payloads.DecryptRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.cryptographic_parameters)
|
self.assertEqual(None, payload.cryptographic_parameters)
|
||||||
|
@ -251,7 +251,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that a Decrypt request payload can be read from a partial data
|
Test that a Decrypt request payload can be read from a partial data
|
||||||
stream containing the minimum required attributes.
|
stream containing the minimum required attributes.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload()
|
payload = payloads.DecryptRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.cryptographic_parameters)
|
self.assertEqual(None, payload.cryptographic_parameters)
|
||||||
|
@ -270,7 +270,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when a required Decrypt request
|
Test that a ValueError gets raised when a required Decrypt request
|
||||||
payload attribute is missing from the payload encoding.
|
payload attribute is missing from the payload encoding.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload()
|
payload = payloads.DecryptRequestPayload()
|
||||||
args = (self.empty_encoding, )
|
args = (self.empty_encoding, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
ValueError,
|
ValueError,
|
||||||
|
@ -283,7 +283,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a Decrypt request payload can be written to a data stream.
|
Test that a Decrypt request payload can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload(
|
payload = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -315,7 +315,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that a partially defined Decrypt request payload can be written
|
Test that a partially defined Decrypt request payload can be written
|
||||||
to a data stream.
|
to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload(
|
payload = payloads.DecryptRequestPayload(
|
||||||
data=b'\x01\x02\x03\x04\x05\x06\x07\x08'
|
data=b'\x01\x02\x03\x04\x05\x06\x07\x08'
|
||||||
)
|
)
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
|
@ -329,7 +329,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when a required Decrypt request
|
Test that a ValueError gets raised when a required Decrypt request
|
||||||
payload attribute is missing when encoding the payload.
|
payload attribute is missing when encoding the payload.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload()
|
payload = payloads.DecryptRequestPayload()
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
args = (stream, )
|
args = (stream, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
|
@ -344,13 +344,13 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
Decrypt request payloads with the same data.
|
Decrypt request payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload()
|
a = payloads.DecryptRequestPayload()
|
||||||
b = decrypt.DecryptRequestPayload()
|
b = payloads.DecryptRequestPayload()
|
||||||
|
|
||||||
self.assertTrue(a == b)
|
self.assertTrue(a == b)
|
||||||
self.assertTrue(b == a)
|
self.assertTrue(b == a)
|
||||||
|
|
||||||
a = decrypt.DecryptRequestPayload(
|
a = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -371,7 +371,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
)
|
)
|
||||||
b = decrypt.DecryptRequestPayload(
|
b = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -401,10 +401,10 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Decrypt request payloads with different unique identifiers.
|
Decrypt request payloads with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload(
|
a = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='a'
|
unique_identifier='a'
|
||||||
)
|
)
|
||||||
b = decrypt.DecryptRequestPayload(
|
b = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='b'
|
unique_identifier='b'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -416,12 +416,12 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Decrypt request payloads with different cryptographic parameters.
|
Decrypt request payloads with different cryptographic parameters.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload(
|
a = payloads.DecryptRequestPayload(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC
|
block_cipher_mode=enums.BlockCipherMode.CBC
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = decrypt.DecryptRequestPayload(
|
b = payloads.DecryptRequestPayload(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.MD5
|
hashing_algorithm=enums.HashingAlgorithm.MD5
|
||||||
)
|
)
|
||||||
|
@ -435,8 +435,8 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Decrypt request payloads with different data.
|
Decrypt request payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload(data=b'\x11')
|
a = payloads.DecryptRequestPayload(data=b'\x11')
|
||||||
b = decrypt.DecryptRequestPayload(data=b'\xFF')
|
b = payloads.DecryptRequestPayload(data=b'\xFF')
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
@ -446,8 +446,8 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Decrypt request payloads with different IV/counter/nonce values.
|
Decrypt request payloads with different IV/counter/nonce values.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload(iv_counter_nonce=b'\x22')
|
a = payloads.DecryptRequestPayload(iv_counter_nonce=b'\x22')
|
||||||
b = decrypt.DecryptRequestPayload(iv_counter_nonce=b'\xAA')
|
b = payloads.DecryptRequestPayload(iv_counter_nonce=b'\xAA')
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
@ -457,7 +457,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Decrypt request payloads with different types.
|
Decrypt request payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload()
|
a = payloads.DecryptRequestPayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
|
@ -468,13 +468,13 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing two
|
Test that the inequality operator returns False when comparing two
|
||||||
Decrypt request payloads with the same data.
|
Decrypt request payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload()
|
a = payloads.DecryptRequestPayload()
|
||||||
b = decrypt.DecryptRequestPayload()
|
b = payloads.DecryptRequestPayload()
|
||||||
|
|
||||||
self.assertFalse(a != b)
|
self.assertFalse(a != b)
|
||||||
self.assertFalse(b != a)
|
self.assertFalse(b != a)
|
||||||
|
|
||||||
a = decrypt.DecryptRequestPayload(
|
a = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -495,7 +495,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
)
|
)
|
||||||
b = decrypt.DecryptRequestPayload(
|
b = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -525,10 +525,10 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Decrypt request payloads with different unique identifiers.
|
Decrypt request payloads with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload(
|
a = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='a'
|
unique_identifier='a'
|
||||||
)
|
)
|
||||||
b = decrypt.DecryptRequestPayload(
|
b = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='b'
|
unique_identifier='b'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -540,12 +540,12 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Decrypt request payloads with different cryptographic parameters.
|
Decrypt request payloads with different cryptographic parameters.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload(
|
a = payloads.DecryptRequestPayload(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC
|
block_cipher_mode=enums.BlockCipherMode.CBC
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = decrypt.DecryptRequestPayload(
|
b = payloads.DecryptRequestPayload(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.MD5
|
hashing_algorithm=enums.HashingAlgorithm.MD5
|
||||||
)
|
)
|
||||||
|
@ -559,8 +559,8 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Decrypt request payloads with different data.
|
Decrypt request payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload(data=b'\x11')
|
a = payloads.DecryptRequestPayload(data=b'\x11')
|
||||||
b = decrypt.DecryptRequestPayload(data=b'\xFF')
|
b = payloads.DecryptRequestPayload(data=b'\xFF')
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
@ -570,8 +570,8 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Decrypt request payloads with different IV/counter/nonce values.
|
Decrypt request payloads with different IV/counter/nonce values.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload(iv_counter_nonce=b'\x22')
|
a = payloads.DecryptRequestPayload(iv_counter_nonce=b'\x22')
|
||||||
b = decrypt.DecryptRequestPayload(iv_counter_nonce=b'\xAA')
|
b = payloads.DecryptRequestPayload(iv_counter_nonce=b'\xAA')
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
@ -581,7 +581,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Decrypt request payloads with different types.
|
Decrypt request payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptRequestPayload()
|
a = payloads.DecryptRequestPayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
|
@ -591,7 +591,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that repr can be applied to an Decrypt request payload.
|
Test that repr can be applied to an Decrypt request payload.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptRequestPayload(
|
payload = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -657,7 +657,7 @@ class TestDecryptRequestPayload(testtools.TestCase):
|
||||||
counter_length=0,
|
counter_length=0,
|
||||||
initial_counter_value=1
|
initial_counter_value=1
|
||||||
)
|
)
|
||||||
payload = decrypt.DecryptRequestPayload(
|
payload = payloads.DecryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=cryptographic_parameters,
|
cryptographic_parameters=cryptographic_parameters,
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
|
@ -724,7 +724,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that an Decrypt response payload can be constructed with no
|
Test that an Decrypt response payload can be constructed with no
|
||||||
arguments.
|
arguments.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptResponsePayload()
|
payload = payloads.DecryptResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.data)
|
self.assertEqual(None, payload.data)
|
||||||
|
@ -734,7 +734,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that a Decrypt response payload can be constructed with valid
|
Test that a Decrypt response payload can be constructed with valid
|
||||||
values
|
values
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptResponsePayload(
|
payload = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='00000000-1111-2222-3333-444444444444',
|
unique_identifier='00000000-1111-2222-3333-444444444444',
|
||||||
data=b'\x01\x02\x03'
|
data=b'\x01\x02\x03'
|
||||||
)
|
)
|
||||||
|
@ -750,7 +750,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the unique identifier of a Decrypt response payload.
|
the unique identifier of a Decrypt response payload.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptResponsePayload()
|
payload = payloads.DecryptResponsePayload()
|
||||||
args = (payload, 'unique_identifier', 0)
|
args = (payload, 'unique_identifier', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -764,7 +764,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the data of a Decrypt response payload.
|
the data of a Decrypt response payload.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptResponsePayload()
|
payload = payloads.DecryptResponsePayload()
|
||||||
args = (payload, 'data', 0)
|
args = (payload, 'data', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -777,7 +777,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a Decrypt response payload can be read from a data stream.
|
Test that a Decrypt response payload can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptResponsePayload()
|
payload = payloads.DecryptResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.data)
|
self.assertEqual(None, payload.data)
|
||||||
|
@ -795,7 +795,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when required Decrypt response
|
Test that a ValueError gets raised when required Decrypt response
|
||||||
payload attributes are missing from the payload encoding.
|
payload attributes are missing from the payload encoding.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptResponsePayload()
|
payload = payloads.DecryptResponsePayload()
|
||||||
args = (self.empty_encoding, )
|
args = (self.empty_encoding, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
ValueError,
|
ValueError,
|
||||||
|
@ -804,7 +804,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
*args
|
*args
|
||||||
)
|
)
|
||||||
|
|
||||||
payload = decrypt.DecryptResponsePayload()
|
payload = payloads.DecryptResponsePayload()
|
||||||
args = (self.incomplete_encoding, )
|
args = (self.incomplete_encoding, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
ValueError,
|
ValueError,
|
||||||
|
@ -817,7 +817,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a Decrypt response payload can be written to a data stream.
|
Test that a Decrypt response payload can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptResponsePayload(
|
payload = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
||||||
)
|
)
|
||||||
|
@ -832,7 +832,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when required Decrypt response
|
Test that a ValueError gets raised when required Decrypt response
|
||||||
payload attributes are missing when encoding the payload.
|
payload attributes are missing when encoding the payload.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptResponsePayload()
|
payload = payloads.DecryptResponsePayload()
|
||||||
self.assertIsNone(payload.unique_identifier)
|
self.assertIsNone(payload.unique_identifier)
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
args = (stream, )
|
args = (stream, )
|
||||||
|
@ -843,7 +843,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
*args
|
*args
|
||||||
)
|
)
|
||||||
|
|
||||||
payload = decrypt.DecryptResponsePayload(
|
payload = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959'
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959'
|
||||||
)
|
)
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
|
@ -860,17 +860,17 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
Decrypt response payloads with the same data.
|
Decrypt response payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptResponsePayload()
|
a = payloads.DecryptResponsePayload()
|
||||||
b = decrypt.DecryptResponsePayload()
|
b = payloads.DecryptResponsePayload()
|
||||||
|
|
||||||
self.assertTrue(a == b)
|
self.assertTrue(a == b)
|
||||||
self.assertTrue(b == a)
|
self.assertTrue(b == a)
|
||||||
|
|
||||||
a = decrypt.DecryptResponsePayload(
|
a = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
||||||
)
|
)
|
||||||
b = decrypt.DecryptResponsePayload(
|
b = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
||||||
)
|
)
|
||||||
|
@ -883,10 +883,10 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Decrypt response payloads with different unique identifiers.
|
Decrypt response payloads with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptResponsePayload(
|
a = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='a'
|
unique_identifier='a'
|
||||||
)
|
)
|
||||||
b = decrypt.DecryptResponsePayload(
|
b = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='b'
|
unique_identifier='b'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -898,8 +898,8 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Decrypt response payloads with different data.
|
Decrypt response payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptResponsePayload(data=b'\x11')
|
a = payloads.DecryptResponsePayload(data=b'\x11')
|
||||||
b = decrypt.DecryptResponsePayload(data=b'\xFF')
|
b = payloads.DecryptResponsePayload(data=b'\xFF')
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
@ -909,7 +909,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Decrypt response payloads with different types.
|
Decrypt response payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptResponsePayload()
|
a = payloads.DecryptResponsePayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
|
@ -920,17 +920,17 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing two
|
Test that the inequality operator returns False when comparing two
|
||||||
Decrypt response payloads with the same data.
|
Decrypt response payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptResponsePayload()
|
a = payloads.DecryptResponsePayload()
|
||||||
b = decrypt.DecryptResponsePayload()
|
b = payloads.DecryptResponsePayload()
|
||||||
|
|
||||||
self.assertFalse(a != b)
|
self.assertFalse(a != b)
|
||||||
self.assertFalse(b != a)
|
self.assertFalse(b != a)
|
||||||
|
|
||||||
a = decrypt.DecryptResponsePayload(
|
a = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
||||||
)
|
)
|
||||||
b = decrypt.DecryptResponsePayload(
|
b = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
||||||
)
|
)
|
||||||
|
@ -943,10 +943,10 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Decrypt response payloads with different unique identifiers.
|
Decrypt response payloads with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptResponsePayload(
|
a = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='a'
|
unique_identifier='a'
|
||||||
)
|
)
|
||||||
b = decrypt.DecryptResponsePayload(
|
b = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='b'
|
unique_identifier='b'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -958,8 +958,8 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Decrypt response payloads with different data.
|
Decrypt response payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptResponsePayload(data=b'\x11')
|
a = payloads.DecryptResponsePayload(data=b'\x11')
|
||||||
b = decrypt.DecryptResponsePayload(data=b'\xFF')
|
b = payloads.DecryptResponsePayload(data=b'\xFF')
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
@ -969,7 +969,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Decrypt response payloads with different types.
|
Decrypt response payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = decrypt.DecryptResponsePayload()
|
a = payloads.DecryptResponsePayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
|
@ -979,7 +979,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that repr can be applied to a Decrypt response payload.
|
Test that repr can be applied to a Decrypt response payload.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptResponsePayload(
|
payload = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
||||||
)
|
)
|
||||||
|
@ -996,7 +996,7 @@ class TestDecryptResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that str can be applied to a Decrypt response payload
|
Test that str can be applied to a Decrypt response payload
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptResponsePayload(
|
payload = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF'
|
||||||
)
|
)
|
||||||
|
|
|
@ -21,7 +21,7 @@ from kmip.core import objects
|
||||||
from kmip.core import primitives
|
from kmip.core import primitives
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
|
|
||||||
from kmip.core.messages.payloads import derive_key
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestDeriveKeyRequestPayload(testtools.TestCase):
|
class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
|
@ -150,7 +150,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a DeriveKey request payload can be constructed with no
|
Test that a DeriveKey request payload can be constructed with no
|
||||||
arguments.
|
arguments.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.object_type)
|
self.assertEqual(None, payload.object_type)
|
||||||
self.assertEqual(None, payload.unique_identifiers)
|
self.assertEqual(None, payload.unique_identifiers)
|
||||||
|
@ -163,7 +163,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a DeriveKey request payload can be constructed with valid
|
Test that a DeriveKey request payload can be constructed with valid
|
||||||
values
|
values
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload(
|
payload = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifiers=['00000000-1111-2222-3333-444444444444'],
|
unique_identifiers=['00000000-1111-2222-3333-444444444444'],
|
||||||
derivation_method=enums.DerivationMethod.HASH,
|
derivation_method=enums.DerivationMethod.HASH,
|
||||||
|
@ -197,7 +197,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the object type of a DeriveKey request payload.
|
the object type of a DeriveKey request payload.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
args = (payload, 'object_type', 'invalid')
|
args = (payload, 'object_type', 'invalid')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -211,7 +211,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when invalid values are used to set
|
Test that a TypeError is raised when invalid values are used to set
|
||||||
the unique identifiers of a DeriveKey request payload.
|
the unique identifiers of a DeriveKey request payload.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
args = (payload, 'unique_identifiers', 'invalid')
|
args = (payload, 'unique_identifiers', 'invalid')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -241,7 +241,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the derivation method of a DeriveKey request payload.
|
the derivation method of a DeriveKey request payload.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
args = (payload, 'derivation_method', 'invalid')
|
args = (payload, 'derivation_method', 'invalid')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -255,7 +255,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the derivation parameters of a DeriveKey request payload.
|
the derivation parameters of a DeriveKey request payload.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
args = (payload, 'derivation_parameters', 'invalid')
|
args = (payload, 'derivation_parameters', 'invalid')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -269,7 +269,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the template attribute of a DeriveKey request payload.
|
the template attribute of a DeriveKey request payload.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
args = (payload, 'template_attribute', 'invalid')
|
args = (payload, 'template_attribute', 'invalid')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -282,7 +282,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a DeriveKey request payload can be read from a data stream.
|
Test that a DeriveKey request payload can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.object_type)
|
self.assertEqual(None, payload.object_type)
|
||||||
self.assertEqual(None, payload.unique_identifiers)
|
self.assertEqual(None, payload.unique_identifiers)
|
||||||
|
@ -347,7 +347,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when decoding a DeriveKey request
|
Test that a ValueError gets raised when decoding a DeriveKey request
|
||||||
payload encoding missing the object type.
|
payload encoding missing the object type.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.object_type)
|
self.assertEqual(None, payload.object_type)
|
||||||
self.assertEqual(None, payload.unique_identifiers)
|
self.assertEqual(None, payload.unique_identifiers)
|
||||||
|
@ -368,7 +368,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when decoding a DeriveKey request
|
Test that a ValueError gets raised when decoding a DeriveKey request
|
||||||
payload encoding missing the unique identifiers.
|
payload encoding missing the unique identifiers.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.object_type)
|
self.assertEqual(None, payload.object_type)
|
||||||
self.assertEqual(None, payload.unique_identifiers)
|
self.assertEqual(None, payload.unique_identifiers)
|
||||||
|
@ -389,7 +389,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when decoding a DeriveKey request
|
Test that a ValueError gets raised when decoding a DeriveKey request
|
||||||
payload encoding missing the derivation method.
|
payload encoding missing the derivation method.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.object_type)
|
self.assertEqual(None, payload.object_type)
|
||||||
self.assertEqual(None, payload.unique_identifiers)
|
self.assertEqual(None, payload.unique_identifiers)
|
||||||
|
@ -410,7 +410,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when decoding a DeriveKey request
|
Test that a ValueError gets raised when decoding a DeriveKey request
|
||||||
payload encoding missing the derivation parameters.
|
payload encoding missing the derivation parameters.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.object_type)
|
self.assertEqual(None, payload.object_type)
|
||||||
self.assertEqual(None, payload.unique_identifiers)
|
self.assertEqual(None, payload.unique_identifiers)
|
||||||
|
@ -431,7 +431,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when decoding a DeriveKey request
|
Test that a ValueError gets raised when decoding a DeriveKey request
|
||||||
payload encoding missing the template attribute.
|
payload encoding missing the template attribute.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.object_type)
|
self.assertEqual(None, payload.object_type)
|
||||||
self.assertEqual(None, payload.unique_identifiers)
|
self.assertEqual(None, payload.unique_identifiers)
|
||||||
|
@ -451,7 +451,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a DeriveKey request payload can be written to a data stream.
|
Test that a DeriveKey request payload can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload(
|
payload = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
|
@ -501,7 +501,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when encoding a DeriveKey request
|
Test that a ValueError gets raised when encoding a DeriveKey request
|
||||||
payload missing the object type.
|
payload missing the object type.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload()
|
payload = payloads.DeriveKeyRequestPayload()
|
||||||
|
|
||||||
args = (utils.BytearrayStream(), )
|
args = (utils.BytearrayStream(), )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
|
@ -516,7 +516,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when encoding a DeriveKey request
|
Test that a ValueError gets raised when encoding a DeriveKey request
|
||||||
payload missing the unique identifiers.
|
payload missing the unique identifiers.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload(
|
payload = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY
|
object_type=enums.ObjectType.SYMMETRIC_KEY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when encoding a DeriveKey request
|
Test that a ValueError gets raised when encoding a DeriveKey request
|
||||||
payload missing the derivation method.
|
payload missing the derivation method.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload(
|
payload = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
|
@ -555,7 +555,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when encoding a DeriveKey request
|
Test that a ValueError gets raised when encoding a DeriveKey request
|
||||||
payload missing the derivation parameters.
|
payload missing the derivation parameters.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload(
|
payload = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
|
@ -578,7 +578,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when encoding a DeriveKey request
|
Test that a ValueError gets raised when encoding a DeriveKey request
|
||||||
payload missing the template attribute.
|
payload missing the template attribute.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyRequestPayload(
|
payload = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
|
@ -608,13 +608,13 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
DeriveKey request payloads with the same data.
|
DeriveKey request payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload()
|
a = payloads.DeriveKeyRequestPayload()
|
||||||
b = derive_key.DeriveKeyRequestPayload()
|
b = payloads.DeriveKeyRequestPayload()
|
||||||
|
|
||||||
self.assertTrue(a == b)
|
self.assertTrue(a == b)
|
||||||
self.assertTrue(b == a)
|
self.assertTrue(b == a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
|
@ -653,7 +653,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
|
@ -701,10 +701,10 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
DeriveKey request payloads with different object types.
|
DeriveKey request payloads with different object types.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY
|
object_type=enums.ObjectType.SYMMETRIC_KEY
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SECRET_DATA
|
object_type=enums.ObjectType.SECRET_DATA
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -716,24 +716,24 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
DeriveKey request payloads with different sets of unique identifiers.
|
DeriveKey request payloads with different sets of unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
unique_identifiers=['fb4b5b9c-6188-4c63-8142-fe9c328129fc']
|
unique_identifiers=['fb4b5b9c-6188-4c63-8142-fe9c328129fc']
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
unique_identifiers=['5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3']
|
unique_identifiers=['5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3']
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
||||||
'1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
'1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'1703250b-4d40-4de2-93a0-c494a1d4ae40',
|
'1703250b-4d40-4de2-93a0-c494a1d4ae40',
|
||||||
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
||||||
|
@ -744,14 +744,14 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
||||||
'1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
'1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(unique_identifiers=[])
|
b = payloads.DeriveKeyRequestPayload(unique_identifiers=[])
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
@ -761,10 +761,10 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
DeriveKey request payloads with different derivation methods.
|
DeriveKey request payloads with different derivation methods.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_method=enums.DerivationMethod.HASH
|
derivation_method=enums.DerivationMethod.HASH
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_method=enums.DerivationMethod.PBKDF2
|
derivation_method=enums.DerivationMethod.PBKDF2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -776,7 +776,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
DeriveKey request payloads with different derivation parameters.
|
DeriveKey request payloads with different derivation parameters.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_parameters=attributes.DerivationParameters(
|
derivation_parameters=attributes.DerivationParameters(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
||||||
|
@ -785,7 +785,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
derivation_data=b'\xFA\xD9\x8B\x6A\xCA\x6D\x87\xDD'
|
derivation_data=b'\xFA\xD9\x8B\x6A\xCA\x6D\x87\xDD'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_parameters=attributes.DerivationParameters(
|
derivation_parameters=attributes.DerivationParameters(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.SHA_1
|
hashing_algorithm=enums.HashingAlgorithm.SHA_1
|
||||||
|
@ -798,7 +798,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_parameters=attributes.DerivationParameters(
|
derivation_parameters=attributes.DerivationParameters(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
||||||
|
@ -807,15 +807,15 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
derivation_data=b'\xFA\xD9\x8B\x6A\xCA\x6D\x87\xDD'
|
derivation_data=b'\xFA\xD9\x8B\x6A\xCA\x6D\x87\xDD'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_parameters=attributes.DerivationParameters()
|
derivation_parameters=attributes.DerivationParameters()
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(derivation_parameters=None)
|
a = payloads.DeriveKeyRequestPayload(derivation_parameters=None)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_parameters=attributes.DerivationParameters(
|
derivation_parameters=attributes.DerivationParameters(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
||||||
|
@ -833,7 +833,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
DeriveKey request payloads with different template attributes.
|
DeriveKey request payloads with different template attributes.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -858,7 +858,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -887,7 +887,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -912,15 +912,15 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
template_attribute=objects.TemplateAttribute()
|
template_attribute=objects.TemplateAttribute()
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(template_attribute=None)
|
a = payloads.DeriveKeyRequestPayload(template_attribute=None)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -954,7 +954,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
DeriveKey request payloads with different types.
|
DeriveKey request payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload()
|
a = payloads.DeriveKeyRequestPayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
|
@ -965,13 +965,13 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing two
|
Test that the inequality operator returns False when comparing two
|
||||||
DeriveKey request payloads with the same data.
|
DeriveKey request payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload()
|
a = payloads.DeriveKeyRequestPayload()
|
||||||
b = derive_key.DeriveKeyRequestPayload()
|
b = payloads.DeriveKeyRequestPayload()
|
||||||
|
|
||||||
self.assertFalse(a != b)
|
self.assertFalse(a != b)
|
||||||
self.assertFalse(b != a)
|
self.assertFalse(b != a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
|
@ -1010,7 +1010,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
|
@ -1058,10 +1058,10 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
DeriveKey request payloads with different object types.
|
DeriveKey request payloads with different object types.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY
|
object_type=enums.ObjectType.SYMMETRIC_KEY
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SECRET_DATA
|
object_type=enums.ObjectType.SECRET_DATA
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1073,24 +1073,24 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
DeriveKey request payloads with different sets of unique identifiers.
|
DeriveKey request payloads with different sets of unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
unique_identifiers=['fb4b5b9c-6188-4c63-8142-fe9c328129fc']
|
unique_identifiers=['fb4b5b9c-6188-4c63-8142-fe9c328129fc']
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
unique_identifiers=['5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3']
|
unique_identifiers=['5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3']
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
||||||
'1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
'1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'1703250b-4d40-4de2-93a0-c494a1d4ae40',
|
'1703250b-4d40-4de2-93a0-c494a1d4ae40',
|
||||||
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
||||||
|
@ -1101,14 +1101,14 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
'5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3',
|
||||||
'1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
'1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(unique_identifiers=[])
|
b = payloads.DeriveKeyRequestPayload(unique_identifiers=[])
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
@ -1118,10 +1118,10 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
DeriveKey request payloads with different derivation methods.
|
DeriveKey request payloads with different derivation methods.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_method=enums.DerivationMethod.HASH
|
derivation_method=enums.DerivationMethod.HASH
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_method=enums.DerivationMethod.PBKDF2
|
derivation_method=enums.DerivationMethod.PBKDF2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1133,7 +1133,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
DeriveKey request payloads with different derivation parameters.
|
DeriveKey request payloads with different derivation parameters.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_parameters=attributes.DerivationParameters(
|
derivation_parameters=attributes.DerivationParameters(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
||||||
|
@ -1142,7 +1142,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
derivation_data=b'\xFA\xD9\x8B\x6A\xCA\x6D\x87\xDD'
|
derivation_data=b'\xFA\xD9\x8B\x6A\xCA\x6D\x87\xDD'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_parameters=attributes.DerivationParameters(
|
derivation_parameters=attributes.DerivationParameters(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.SHA_1
|
hashing_algorithm=enums.HashingAlgorithm.SHA_1
|
||||||
|
@ -1155,7 +1155,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_parameters=attributes.DerivationParameters(
|
derivation_parameters=attributes.DerivationParameters(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
||||||
|
@ -1164,15 +1164,15 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
derivation_data=b'\xFA\xD9\x8B\x6A\xCA\x6D\x87\xDD'
|
derivation_data=b'\xFA\xD9\x8B\x6A\xCA\x6D\x87\xDD'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_parameters=attributes.DerivationParameters()
|
derivation_parameters=attributes.DerivationParameters()
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(derivation_parameters=None)
|
a = payloads.DeriveKeyRequestPayload(derivation_parameters=None)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
derivation_parameters=attributes.DerivationParameters(
|
derivation_parameters=attributes.DerivationParameters(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
hashing_algorithm=enums.HashingAlgorithm.SHA_256
|
||||||
|
@ -1190,7 +1190,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
DeriveKey request payloads with different template attribute.
|
DeriveKey request payloads with different template attribute.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -1215,7 +1215,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -1244,7 +1244,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(
|
a = payloads.DeriveKeyRequestPayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -1269,15 +1269,15 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
template_attribute=objects.TemplateAttribute()
|
template_attribute=objects.TemplateAttribute()
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyRequestPayload(template_attribute=None)
|
a = payloads.DeriveKeyRequestPayload(template_attribute=None)
|
||||||
b = derive_key.DeriveKeyRequestPayload(
|
b = payloads.DeriveKeyRequestPayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -1311,7 +1311,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
DeriveKey request payloads with different types.
|
DeriveKey request payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyRequestPayload()
|
a = payloads.DeriveKeyRequestPayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
|
@ -1351,7 +1351,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
payload = derive_key.DeriveKeyRequestPayload(
|
payload = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
|
@ -1417,7 +1417,7 @@ class TestDeriveKeyRequestPayload(testtools.TestCase):
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
payload = derive_key.DeriveKeyRequestPayload(
|
payload = payloads.DeriveKeyRequestPayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifiers=[
|
unique_identifiers=[
|
||||||
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
'fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
|
@ -1506,7 +1506,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that a DeriveKey response payload can be constructed with no
|
Test that a DeriveKey response payload can be constructed with no
|
||||||
arguments.
|
arguments.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyResponsePayload()
|
payload = payloads.DeriveKeyResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.template_attribute)
|
self.assertEqual(None, payload.template_attribute)
|
||||||
|
@ -1516,7 +1516,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that a DeriveKey response payload can be constructed with valid
|
Test that a DeriveKey response payload can be constructed with valid
|
||||||
values
|
values
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyResponsePayload(
|
payload = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='00000000-1111-2222-3333-444444444444',
|
unique_identifier='00000000-1111-2222-3333-444444444444',
|
||||||
template_attribute=objects.TemplateAttribute()
|
template_attribute=objects.TemplateAttribute()
|
||||||
)
|
)
|
||||||
|
@ -1535,7 +1535,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when invalid values are used to set
|
Test that a TypeError is raised when invalid values are used to set
|
||||||
the unique identifier of a DeriveKey request payload.
|
the unique identifier of a DeriveKey request payload.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyResponsePayload()
|
payload = payloads.DeriveKeyResponsePayload()
|
||||||
args = (payload, 'unique_identifier', 0)
|
args = (payload, 'unique_identifier', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -1549,7 +1549,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the template attribute of a DeriveKey response payload.
|
the template attribute of a DeriveKey response payload.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyResponsePayload()
|
payload = payloads.DeriveKeyResponsePayload()
|
||||||
args = (payload, 'template_attribute', 'invalid')
|
args = (payload, 'template_attribute', 'invalid')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -1562,7 +1562,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a DeriveKey response payload can be read from a data stream.
|
Test that a DeriveKey response payload can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyResponsePayload()
|
payload = payloads.DeriveKeyResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.template_attribute)
|
self.assertEqual(None, payload.template_attribute)
|
||||||
|
@ -1605,7 +1605,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when decoding a DeriveKey response
|
Test that a ValueError gets raised when decoding a DeriveKey response
|
||||||
payload encoding missing the unique identifier.
|
payload encoding missing the unique identifier.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyResponsePayload()
|
payload = payloads.DeriveKeyResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.template_attribute)
|
self.assertEqual(None, payload.template_attribute)
|
||||||
|
@ -1624,7 +1624,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that a DeriveKey response payload missing a template attribute
|
Test that a DeriveKey response payload missing a template attribute
|
||||||
can be read from a data stream.
|
can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyResponsePayload()
|
payload = payloads.DeriveKeyResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.template_attribute)
|
self.assertEqual(None, payload.template_attribute)
|
||||||
|
@ -1641,7 +1641,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a DeriveKey response payload can be written to a data stream.
|
Test that a DeriveKey response payload can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyResponsePayload(
|
payload = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
|
@ -1678,7 +1678,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when encoding a DeriveKey response
|
Test that a ValueError gets raised when encoding a DeriveKey response
|
||||||
payload missing the unique identifier.
|
payload missing the unique identifier.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyResponsePayload()
|
payload = payloads.DeriveKeyResponsePayload()
|
||||||
|
|
||||||
args = (utils.BytearrayStream(), )
|
args = (utils.BytearrayStream(), )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
|
@ -1693,7 +1693,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when encoding a DeriveKey response
|
Test that a ValueError gets raised when encoding a DeriveKey response
|
||||||
payload missing the template attribute.
|
payload missing the template attribute.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyResponsePayload(
|
payload = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc'
|
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc'
|
||||||
)
|
)
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
|
@ -1714,13 +1714,13 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
DeriveKey response payloads with the same data.
|
DeriveKey response payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyResponsePayload()
|
a = payloads.DeriveKeyResponsePayload()
|
||||||
b = derive_key.DeriveKeyResponsePayload()
|
b = payloads.DeriveKeyResponsePayload()
|
||||||
|
|
||||||
self.assertTrue(a == b)
|
self.assertTrue(a == b)
|
||||||
self.assertTrue(b == a)
|
self.assertTrue(b == a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyResponsePayload(
|
a = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
|
@ -1746,7 +1746,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyResponsePayload(
|
b = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
|
@ -1781,20 +1781,20 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
DeriveKey response payloads with different unique identifiers.
|
DeriveKey response payloads with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyResponsePayload(
|
a = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc'
|
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc'
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyResponsePayload(
|
b = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3'
|
unique_identifier='5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3'
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyResponsePayload(
|
a = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
unique_identifier='1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyResponsePayload(unique_identifier=None)
|
b = payloads.DeriveKeyResponsePayload(unique_identifier=None)
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
@ -1804,7 +1804,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
DeriveKey response payloads with different template attributes.
|
DeriveKey response payloads with different template attributes.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyResponsePayload(
|
a = payloads.DeriveKeyResponsePayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -1829,7 +1829,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyResponsePayload(
|
b = payloads.DeriveKeyResponsePayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -1858,7 +1858,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyResponsePayload(
|
a = payloads.DeriveKeyResponsePayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -1883,15 +1883,15 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyResponsePayload(
|
b = payloads.DeriveKeyResponsePayload(
|
||||||
template_attribute=objects.TemplateAttribute()
|
template_attribute=objects.TemplateAttribute()
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyResponsePayload(template_attribute=None)
|
a = payloads.DeriveKeyResponsePayload(template_attribute=None)
|
||||||
b = derive_key.DeriveKeyResponsePayload(
|
b = payloads.DeriveKeyResponsePayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -1925,7 +1925,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
DeriveKey response payloads with different types.
|
DeriveKey response payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyResponsePayload()
|
a = payloads.DeriveKeyResponsePayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
|
@ -1936,13 +1936,13 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing two
|
Test that the inequality operator returns False when comparing two
|
||||||
DeriveKey response payloads with the same data.
|
DeriveKey response payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyResponsePayload()
|
a = payloads.DeriveKeyResponsePayload()
|
||||||
b = derive_key.DeriveKeyResponsePayload()
|
b = payloads.DeriveKeyResponsePayload()
|
||||||
|
|
||||||
self.assertFalse(a != b)
|
self.assertFalse(a != b)
|
||||||
self.assertFalse(b != a)
|
self.assertFalse(b != a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyResponsePayload(
|
a = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
|
@ -1968,7 +1968,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyResponsePayload(
|
b = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
|
@ -2006,20 +2006,20 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
DeriveKey response payloads with different unique identifiers.
|
DeriveKey response payloads with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyResponsePayload(
|
a = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc'
|
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc'
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyResponsePayload(
|
b = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3'
|
unique_identifier='5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3'
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyResponsePayload(
|
a = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
unique_identifier='1703250b-4d40-4de2-93a0-c494a1d4ae40'
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyResponsePayload(unique_identifier=None)
|
b = payloads.DeriveKeyResponsePayload(unique_identifier=None)
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
@ -2029,7 +2029,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
DeriveKey response payloads with different template attribute.
|
DeriveKey response payloads with different template attribute.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyResponsePayload(
|
a = payloads.DeriveKeyResponsePayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -2054,7 +2054,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyResponsePayload(
|
b = payloads.DeriveKeyResponsePayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -2083,7 +2083,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyResponsePayload(
|
a = payloads.DeriveKeyResponsePayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -2108,15 +2108,15 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = derive_key.DeriveKeyResponsePayload(
|
b = payloads.DeriveKeyResponsePayload(
|
||||||
template_attribute=objects.TemplateAttribute()
|
template_attribute=objects.TemplateAttribute()
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
|
||||||
a = derive_key.DeriveKeyResponsePayload(template_attribute=None)
|
a = payloads.DeriveKeyResponsePayload(template_attribute=None)
|
||||||
b = derive_key.DeriveKeyResponsePayload(
|
b = payloads.DeriveKeyResponsePayload(
|
||||||
template_attribute=objects.TemplateAttribute(
|
template_attribute=objects.TemplateAttribute(
|
||||||
attributes=[
|
attributes=[
|
||||||
objects.Attribute(
|
objects.Attribute(
|
||||||
|
@ -2150,7 +2150,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
DeriveKey response payloads with different types.
|
DeriveKey response payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = derive_key.DeriveKeyResponsePayload()
|
a = payloads.DeriveKeyResponsePayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
|
@ -2183,7 +2183,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
payload = derive_key.DeriveKeyResponsePayload(
|
payload = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
template_attribute=template_attribute
|
template_attribute=template_attribute
|
||||||
)
|
)
|
||||||
|
@ -2228,7 +2228,7 @@ class TestDeriveKeyResponsePayload(testtools.TestCase):
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
payload = derive_key.DeriveKeyResponsePayload(
|
payload = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
unique_identifier='fb4b5b9c-6188-4c63-8142-fe9c328129fc',
|
||||||
template_attribute=template_attribute
|
template_attribute=template_attribute
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,7 +20,7 @@ from testtools import TestCase
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
|
|
||||||
from kmip.core.messages.contents import ProtocolVersion
|
from kmip.core.messages.contents import ProtocolVersion
|
||||||
from kmip.core.messages.payloads import discover_versions
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestDiscoverVersionsRequestPayload(TestCase):
|
class TestDiscoverVersionsRequestPayload(TestCase):
|
||||||
|
@ -54,23 +54,23 @@ class TestDiscoverVersionsRequestPayload(TestCase):
|
||||||
super(TestDiscoverVersionsRequestPayload, self).tearDown()
|
super(TestDiscoverVersionsRequestPayload, self).tearDown()
|
||||||
|
|
||||||
def test_init_with_none(self):
|
def test_init_with_none(self):
|
||||||
discover_versions.DiscoverVersionsRequestPayload()
|
payloads.DiscoverVersionsRequestPayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
discover_versions.DiscoverVersionsRequestPayload(
|
payloads.DiscoverVersionsRequestPayload(
|
||||||
self.protocol_versions_empty)
|
self.protocol_versions_empty)
|
||||||
|
|
||||||
def test_validate_with_invalid_protocol_versions(self):
|
def test_validate_with_invalid_protocol_versions(self):
|
||||||
kwargs = {'protocol_versions': 'invalid'}
|
kwargs = {'protocol_versions': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid protocol versions list",
|
TypeError, "invalid protocol versions list",
|
||||||
discover_versions.DiscoverVersionsRequestPayload, **kwargs)
|
payloads.DiscoverVersionsRequestPayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_protocol_version(self):
|
def test_validate_with_invalid_protocol_version(self):
|
||||||
kwargs = {'protocol_versions': ['invalid']}
|
kwargs = {'protocol_versions': ['invalid']}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid protocol version",
|
TypeError, "invalid protocol version",
|
||||||
discover_versions.DiscoverVersionsRequestPayload, **kwargs)
|
payloads.DiscoverVersionsRequestPayload, **kwargs)
|
||||||
|
|
||||||
def _test_read(self, stream, payload, protocol_versions):
|
def _test_read(self, stream, payload, protocol_versions):
|
||||||
payload.read(stream)
|
payload.read(stream)
|
||||||
|
@ -92,21 +92,21 @@ class TestDiscoverVersionsRequestPayload(TestCase):
|
||||||
|
|
||||||
def test_read_with_empty_protocol_list(self):
|
def test_read_with_empty_protocol_list(self):
|
||||||
stream = self.encoding_empty
|
stream = self.encoding_empty
|
||||||
payload = discover_versions.DiscoverVersionsRequestPayload()
|
payload = payloads.DiscoverVersionsRequestPayload()
|
||||||
protocol_versions = self.protocol_versions_empty
|
protocol_versions = self.protocol_versions_empty
|
||||||
|
|
||||||
self._test_read(stream, payload, protocol_versions)
|
self._test_read(stream, payload, protocol_versions)
|
||||||
|
|
||||||
def test_read_with_one_protocol_version(self):
|
def test_read_with_one_protocol_version(self):
|
||||||
stream = self.encoding_one
|
stream = self.encoding_one
|
||||||
payload = discover_versions.DiscoverVersionsRequestPayload()
|
payload = payloads.DiscoverVersionsRequestPayload()
|
||||||
protocol_versions = self.protocol_versions_one
|
protocol_versions = self.protocol_versions_one
|
||||||
|
|
||||||
self._test_read(stream, payload, protocol_versions)
|
self._test_read(stream, payload, protocol_versions)
|
||||||
|
|
||||||
def test_read_with_two_protocol_versions(self):
|
def test_read_with_two_protocol_versions(self):
|
||||||
stream = self.encoding_two
|
stream = self.encoding_two
|
||||||
payload = discover_versions.DiscoverVersionsRequestPayload()
|
payload = payloads.DiscoverVersionsRequestPayload()
|
||||||
protocol_versions = self.protocol_versions_two
|
protocol_versions = self.protocol_versions_two
|
||||||
|
|
||||||
self._test_read(stream, payload, protocol_versions)
|
self._test_read(stream, payload, protocol_versions)
|
||||||
|
@ -129,21 +129,21 @@ class TestDiscoverVersionsRequestPayload(TestCase):
|
||||||
self.assertEqual(expected, stream, msg)
|
self.assertEqual(expected, stream, msg)
|
||||||
|
|
||||||
def test_write_with_empty_protocol_list(self):
|
def test_write_with_empty_protocol_list(self):
|
||||||
payload = discover_versions.DiscoverVersionsRequestPayload(
|
payload = payloads.DiscoverVersionsRequestPayload(
|
||||||
self.protocol_versions_empty)
|
self.protocol_versions_empty)
|
||||||
expected = self.encoding_empty
|
expected = self.encoding_empty
|
||||||
|
|
||||||
self._test_write(payload, expected)
|
self._test_write(payload, expected)
|
||||||
|
|
||||||
def test_write_with_one_protocol_version(self):
|
def test_write_with_one_protocol_version(self):
|
||||||
payload = discover_versions.DiscoverVersionsRequestPayload(
|
payload = payloads.DiscoverVersionsRequestPayload(
|
||||||
self.protocol_versions_one)
|
self.protocol_versions_one)
|
||||||
expected = self.encoding_one
|
expected = self.encoding_one
|
||||||
|
|
||||||
self._test_write(payload, expected)
|
self._test_write(payload, expected)
|
||||||
|
|
||||||
def test_write_with_two_protocol_versions(self):
|
def test_write_with_two_protocol_versions(self):
|
||||||
payload = discover_versions.DiscoverVersionsRequestPayload(
|
payload = payloads.DiscoverVersionsRequestPayload(
|
||||||
self.protocol_versions_two)
|
self.protocol_versions_two)
|
||||||
expected = self.encoding_two
|
expected = self.encoding_two
|
||||||
|
|
||||||
|
@ -181,23 +181,23 @@ class TestDiscoverVersionsResponsePayload(TestCase):
|
||||||
super(TestDiscoverVersionsResponsePayload, self).tearDown()
|
super(TestDiscoverVersionsResponsePayload, self).tearDown()
|
||||||
|
|
||||||
def test_init_with_none(self):
|
def test_init_with_none(self):
|
||||||
discover_versions.DiscoverVersionsResponsePayload()
|
payloads.DiscoverVersionsResponsePayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
discover_versions.DiscoverVersionsResponsePayload(
|
payloads.DiscoverVersionsResponsePayload(
|
||||||
self.protocol_versions_empty)
|
self.protocol_versions_empty)
|
||||||
|
|
||||||
def test_validate_with_invalid_protocol_versions(self):
|
def test_validate_with_invalid_protocol_versions(self):
|
||||||
kwargs = {'protocol_versions': 'invalid'}
|
kwargs = {'protocol_versions': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid protocol versions list",
|
TypeError, "invalid protocol versions list",
|
||||||
discover_versions.DiscoverVersionsResponsePayload, **kwargs)
|
payloads.DiscoverVersionsResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_protocol_version(self):
|
def test_validate_with_invalid_protocol_version(self):
|
||||||
kwargs = {'protocol_versions': ['invalid']}
|
kwargs = {'protocol_versions': ['invalid']}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid protocol version",
|
TypeError, "invalid protocol version",
|
||||||
discover_versions.DiscoverVersionsResponsePayload, **kwargs)
|
payloads.DiscoverVersionsResponsePayload, **kwargs)
|
||||||
|
|
||||||
def _test_read(self, stream, payload, protocol_versions):
|
def _test_read(self, stream, payload, protocol_versions):
|
||||||
payload.read(stream)
|
payload.read(stream)
|
||||||
|
@ -219,21 +219,21 @@ class TestDiscoverVersionsResponsePayload(TestCase):
|
||||||
|
|
||||||
def test_read_with_empty_protocol_list(self):
|
def test_read_with_empty_protocol_list(self):
|
||||||
stream = self.encoding_empty
|
stream = self.encoding_empty
|
||||||
payload = discover_versions.DiscoverVersionsResponsePayload()
|
payload = payloads.DiscoverVersionsResponsePayload()
|
||||||
protocol_versions = self.protocol_versions_empty
|
protocol_versions = self.protocol_versions_empty
|
||||||
|
|
||||||
self._test_read(stream, payload, protocol_versions)
|
self._test_read(stream, payload, protocol_versions)
|
||||||
|
|
||||||
def test_read_with_one_protocol_version(self):
|
def test_read_with_one_protocol_version(self):
|
||||||
stream = self.encoding_one
|
stream = self.encoding_one
|
||||||
payload = discover_versions.DiscoverVersionsResponsePayload()
|
payload = payloads.DiscoverVersionsResponsePayload()
|
||||||
protocol_versions = self.protocol_versions_one
|
protocol_versions = self.protocol_versions_one
|
||||||
|
|
||||||
self._test_read(stream, payload, protocol_versions)
|
self._test_read(stream, payload, protocol_versions)
|
||||||
|
|
||||||
def test_read_with_two_protocol_versions(self):
|
def test_read_with_two_protocol_versions(self):
|
||||||
stream = self.encoding_two
|
stream = self.encoding_two
|
||||||
payload = discover_versions.DiscoverVersionsResponsePayload()
|
payload = payloads.DiscoverVersionsResponsePayload()
|
||||||
protocol_versions = self.protocol_versions_two
|
protocol_versions = self.protocol_versions_two
|
||||||
|
|
||||||
self._test_read(stream, payload, protocol_versions)
|
self._test_read(stream, payload, protocol_versions)
|
||||||
|
@ -256,21 +256,21 @@ class TestDiscoverVersionsResponsePayload(TestCase):
|
||||||
self.assertEqual(expected, stream, msg)
|
self.assertEqual(expected, stream, msg)
|
||||||
|
|
||||||
def test_write_with_empty_protocol_list(self):
|
def test_write_with_empty_protocol_list(self):
|
||||||
payload = discover_versions.DiscoverVersionsResponsePayload(
|
payload = payloads.DiscoverVersionsResponsePayload(
|
||||||
self.protocol_versions_empty)
|
self.protocol_versions_empty)
|
||||||
expected = self.encoding_empty
|
expected = self.encoding_empty
|
||||||
|
|
||||||
self._test_write(payload, expected)
|
self._test_write(payload, expected)
|
||||||
|
|
||||||
def test_write_with_one_protocol_version(self):
|
def test_write_with_one_protocol_version(self):
|
||||||
payload = discover_versions.DiscoverVersionsResponsePayload(
|
payload = payloads.DiscoverVersionsResponsePayload(
|
||||||
self.protocol_versions_one)
|
self.protocol_versions_one)
|
||||||
expected = self.encoding_one
|
expected = self.encoding_one
|
||||||
|
|
||||||
self._test_write(payload, expected)
|
self._test_write(payload, expected)
|
||||||
|
|
||||||
def test_write_with_two_protocol_versions(self):
|
def test_write_with_two_protocol_versions(self):
|
||||||
payload = discover_versions.DiscoverVersionsResponsePayload(
|
payload = payloads.DiscoverVersionsResponsePayload(
|
||||||
self.protocol_versions_two)
|
self.protocol_versions_two)
|
||||||
expected = self.encoding_two
|
expected = self.encoding_two
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ from kmip.core import attributes
|
||||||
from kmip.core import enums
|
from kmip.core import enums
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
|
|
||||||
from kmip.core.messages.payloads import encrypt
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestEncryptRequestPayload(testtools.TestCase):
|
class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
|
@ -98,7 +98,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that an Encrypt request payload can be constructed with no
|
Test that an Encrypt request payload can be constructed with no
|
||||||
arguments.
|
arguments.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload()
|
payload = payloads.EncryptRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.cryptographic_parameters)
|
self.assertEqual(None, payload.cryptographic_parameters)
|
||||||
|
@ -110,7 +110,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that an Encrypt request payload can be constructed with valid
|
Test that an Encrypt request payload can be constructed with valid
|
||||||
values
|
values
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload(
|
payload = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='00000000-1111-2222-3333-444444444444',
|
unique_identifier='00000000-1111-2222-3333-444444444444',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(),
|
cryptographic_parameters=attributes.CryptographicParameters(),
|
||||||
data=b'\x01\x02\x03',
|
data=b'\x01\x02\x03',
|
||||||
|
@ -133,7 +133,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the unique identifier of an Encrypt request payload.
|
the unique identifier of an Encrypt request payload.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload()
|
payload = payloads.EncryptRequestPayload()
|
||||||
args = (payload, 'unique_identifier', 0)
|
args = (payload, 'unique_identifier', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -147,7 +147,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the cryptographic parameters of an Encrypt request payload.
|
the cryptographic parameters of an Encrypt request payload.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload()
|
payload = payloads.EncryptRequestPayload()
|
||||||
args = (payload, 'cryptographic_parameters', 'invalid')
|
args = (payload, 'cryptographic_parameters', 'invalid')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -162,7 +162,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the data of an Encrypt request payload.
|
the data of an Encrypt request payload.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload()
|
payload = payloads.EncryptRequestPayload()
|
||||||
args = (payload, 'data', 0)
|
args = (payload, 'data', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -176,7 +176,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the IV/counter/nonce of an Encrypt request payload.
|
the IV/counter/nonce of an Encrypt request payload.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload()
|
payload = payloads.EncryptRequestPayload()
|
||||||
args = (payload, 'iv_counter_nonce', 0)
|
args = (payload, 'iv_counter_nonce', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -189,7 +189,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that an Encrypt request payload can be read from a data stream.
|
Test that an Encrypt request payload can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload()
|
payload = payloads.EncryptRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.cryptographic_parameters)
|
self.assertEqual(None, payload.cryptographic_parameters)
|
||||||
|
@ -251,7 +251,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that an Encrypt request payload can be read from a partial data
|
Test that an Encrypt request payload can be read from a partial data
|
||||||
stream containing the minimum required attributes.
|
stream containing the minimum required attributes.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload()
|
payload = payloads.EncryptRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.cryptographic_parameters)
|
self.assertEqual(None, payload.cryptographic_parameters)
|
||||||
|
@ -270,7 +270,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when a required Encrypt request
|
Test that a ValueError gets raised when a required Encrypt request
|
||||||
payload attribute is missing from the payload encoding.
|
payload attribute is missing from the payload encoding.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload()
|
payload = payloads.EncryptRequestPayload()
|
||||||
args = (self.empty_encoding, )
|
args = (self.empty_encoding, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
ValueError,
|
ValueError,
|
||||||
|
@ -283,7 +283,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that an Encrypt request payload can be written to a data stream.
|
Test that an Encrypt request payload can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload(
|
payload = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -315,7 +315,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that a partially defined Encrypt request payload can be written
|
Test that a partially defined Encrypt request payload can be written
|
||||||
to a data stream.
|
to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload(
|
payload = payloads.EncryptRequestPayload(
|
||||||
data=b'\x01\x02\x03\x04\x05\x06\x07\x08'
|
data=b'\x01\x02\x03\x04\x05\x06\x07\x08'
|
||||||
)
|
)
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
|
@ -329,7 +329,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when a required Encrypt request
|
Test that a ValueError gets raised when a required Encrypt request
|
||||||
payload attribute is missing when encoding the payload.
|
payload attribute is missing when encoding the payload.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload()
|
payload = payloads.EncryptRequestPayload()
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
args = (stream, )
|
args = (stream, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
|
@ -344,13 +344,13 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
Encrypt request payloads with the same data.
|
Encrypt request payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload()
|
a = payloads.EncryptRequestPayload()
|
||||||
b = encrypt.EncryptRequestPayload()
|
b = payloads.EncryptRequestPayload()
|
||||||
|
|
||||||
self.assertTrue(a == b)
|
self.assertTrue(a == b)
|
||||||
self.assertTrue(b == a)
|
self.assertTrue(b == a)
|
||||||
|
|
||||||
a = encrypt.EncryptRequestPayload(
|
a = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -371,7 +371,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
)
|
)
|
||||||
b = encrypt.EncryptRequestPayload(
|
b = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -401,10 +401,10 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Encrypt request payloads with different unique identifiers.
|
Encrypt request payloads with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload(
|
a = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='a'
|
unique_identifier='a'
|
||||||
)
|
)
|
||||||
b = encrypt.EncryptRequestPayload(
|
b = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='b'
|
unique_identifier='b'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -416,12 +416,12 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Encrypt request payloads with different cryptographic parameters.
|
Encrypt request payloads with different cryptographic parameters.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload(
|
a = payloads.EncryptRequestPayload(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC
|
block_cipher_mode=enums.BlockCipherMode.CBC
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = encrypt.EncryptRequestPayload(
|
b = payloads.EncryptRequestPayload(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.MD5
|
hashing_algorithm=enums.HashingAlgorithm.MD5
|
||||||
)
|
)
|
||||||
|
@ -435,8 +435,8 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Encrypt request payloads with different data.
|
Encrypt request payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload(data=b'\x11')
|
a = payloads.EncryptRequestPayload(data=b'\x11')
|
||||||
b = encrypt.EncryptRequestPayload(data=b'\xFF')
|
b = payloads.EncryptRequestPayload(data=b'\xFF')
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
@ -446,8 +446,8 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Encrypt request payloads with different IV/counter/nonce values.
|
Encrypt request payloads with different IV/counter/nonce values.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload(iv_counter_nonce=b'\x22')
|
a = payloads.EncryptRequestPayload(iv_counter_nonce=b'\x22')
|
||||||
b = encrypt.EncryptRequestPayload(iv_counter_nonce=b'\xAA')
|
b = payloads.EncryptRequestPayload(iv_counter_nonce=b'\xAA')
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
@ -457,7 +457,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Encrypt request payloads with different types.
|
Encrypt request payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload()
|
a = payloads.EncryptRequestPayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
|
@ -468,13 +468,13 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing two
|
Test that the inequality operator returns False when comparing two
|
||||||
Encrypt request payloads with the same data.
|
Encrypt request payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload()
|
a = payloads.EncryptRequestPayload()
|
||||||
b = encrypt.EncryptRequestPayload()
|
b = payloads.EncryptRequestPayload()
|
||||||
|
|
||||||
self.assertFalse(a != b)
|
self.assertFalse(a != b)
|
||||||
self.assertFalse(b != a)
|
self.assertFalse(b != a)
|
||||||
|
|
||||||
a = encrypt.EncryptRequestPayload(
|
a = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -495,7 +495,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
)
|
)
|
||||||
b = encrypt.EncryptRequestPayload(
|
b = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -525,10 +525,10 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Encrypt request payloads with different unique identifiers.
|
Encrypt request payloads with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload(
|
a = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='a'
|
unique_identifier='a'
|
||||||
)
|
)
|
||||||
b = encrypt.EncryptRequestPayload(
|
b = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='b'
|
unique_identifier='b'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -540,12 +540,12 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Encrypt request payloads with different cryptographic parameters.
|
Encrypt request payloads with different cryptographic parameters.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload(
|
a = payloads.EncryptRequestPayload(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC
|
block_cipher_mode=enums.BlockCipherMode.CBC
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = encrypt.EncryptRequestPayload(
|
b = payloads.EncryptRequestPayload(
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
hashing_algorithm=enums.HashingAlgorithm.MD5
|
hashing_algorithm=enums.HashingAlgorithm.MD5
|
||||||
)
|
)
|
||||||
|
@ -559,8 +559,8 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Encrypt request payloads with different data.
|
Encrypt request payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload(data=b'\x11')
|
a = payloads.EncryptRequestPayload(data=b'\x11')
|
||||||
b = encrypt.EncryptRequestPayload(data=b'\xFF')
|
b = payloads.EncryptRequestPayload(data=b'\xFF')
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
@ -570,8 +570,8 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Encrypt request payloads with different IV/counter/nonce values.
|
Encrypt request payloads with different IV/counter/nonce values.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload(iv_counter_nonce=b'\x22')
|
a = payloads.EncryptRequestPayload(iv_counter_nonce=b'\x22')
|
||||||
b = encrypt.EncryptRequestPayload(iv_counter_nonce=b'\xAA')
|
b = payloads.EncryptRequestPayload(iv_counter_nonce=b'\xAA')
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
@ -581,7 +581,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Encrypt request payloads with different types.
|
Encrypt request payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptRequestPayload()
|
a = payloads.EncryptRequestPayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
|
@ -591,7 +591,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that repr can be applied to an Encrypt request payload.
|
Test that repr can be applied to an Encrypt request payload.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptRequestPayload(
|
payload = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=attributes.CryptographicParameters(
|
cryptographic_parameters=attributes.CryptographicParameters(
|
||||||
block_cipher_mode=enums.BlockCipherMode.CBC,
|
block_cipher_mode=enums.BlockCipherMode.CBC,
|
||||||
|
@ -657,7 +657,7 @@ class TestEncryptRequestPayload(testtools.TestCase):
|
||||||
counter_length=0,
|
counter_length=0,
|
||||||
initial_counter_value=1
|
initial_counter_value=1
|
||||||
)
|
)
|
||||||
payload = encrypt.EncryptRequestPayload(
|
payload = payloads.EncryptRequestPayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
cryptographic_parameters=cryptographic_parameters,
|
cryptographic_parameters=cryptographic_parameters,
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
|
@ -738,7 +738,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that an Encrypt response payload can be constructed with no
|
Test that an Encrypt response payload can be constructed with no
|
||||||
arguments.
|
arguments.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload()
|
payload = payloads.EncryptResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.data)
|
self.assertEqual(None, payload.data)
|
||||||
|
@ -749,7 +749,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that an Encrypt response payload can be constructed with valid
|
Test that an Encrypt response payload can be constructed with valid
|
||||||
values
|
values
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload(
|
payload = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='00000000-1111-2222-3333-444444444444',
|
unique_identifier='00000000-1111-2222-3333-444444444444',
|
||||||
data=b'\x01\x02\x03',
|
data=b'\x01\x02\x03',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
|
@ -767,7 +767,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the unique identifier of an Encrypt response payload.
|
the unique identifier of an Encrypt response payload.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload()
|
payload = payloads.EncryptResponsePayload()
|
||||||
args = (payload, 'unique_identifier', 0)
|
args = (payload, 'unique_identifier', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -781,7 +781,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the data of an Encrypt response payload.
|
the data of an Encrypt response payload.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload()
|
payload = payloads.EncryptResponsePayload()
|
||||||
args = (payload, 'data', 0)
|
args = (payload, 'data', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -795,7 +795,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid value is used to set
|
Test that a TypeError is raised when an invalid value is used to set
|
||||||
the IV/counter/nonce of an Encrypt response payload.
|
the IV/counter/nonce of an Encrypt response payload.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload()
|
payload = payloads.EncryptResponsePayload()
|
||||||
args = (payload, 'iv_counter_nonce', 0)
|
args = (payload, 'iv_counter_nonce', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -808,7 +808,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that an Encrypt response payload can be read from a data stream.
|
Test that an Encrypt response payload can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload()
|
payload = payloads.EncryptResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.data)
|
self.assertEqual(None, payload.data)
|
||||||
|
@ -828,7 +828,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that an Encrypt response payload can be read from a partial data
|
Test that an Encrypt response payload can be read from a partial data
|
||||||
stream containing the minimum required attributes.
|
stream containing the minimum required attributes.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload()
|
payload = payloads.EncryptResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.data)
|
self.assertEqual(None, payload.data)
|
||||||
|
@ -848,7 +848,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when required Encrypt response
|
Test that a ValueError gets raised when required Encrypt response
|
||||||
payload attributes are missing from the payload encoding.
|
payload attributes are missing from the payload encoding.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload()
|
payload = payloads.EncryptResponsePayload()
|
||||||
args = (self.empty_encoding, )
|
args = (self.empty_encoding, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
ValueError,
|
ValueError,
|
||||||
|
@ -857,7 +857,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
*args
|
*args
|
||||||
)
|
)
|
||||||
|
|
||||||
payload = encrypt.EncryptResponsePayload()
|
payload = payloads.EncryptResponsePayload()
|
||||||
args = (self.incomplete_encoding, )
|
args = (self.incomplete_encoding, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
ValueError,
|
ValueError,
|
||||||
|
@ -870,7 +870,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that an Encrypt response payload can be written to a data stream.
|
Test that an Encrypt response payload can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload(
|
payload = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
|
@ -886,7 +886,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that a partially defined Encrypt response payload can be written
|
Test that a partially defined Encrypt response payload can be written
|
||||||
to a data stream.
|
to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload(
|
payload = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x02\x03\x04\x05\x06\x07\x08'
|
data=b'\x01\x02\x03\x04\x05\x06\x07\x08'
|
||||||
)
|
)
|
||||||
|
@ -901,7 +901,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when required Encrypt response
|
Test that a ValueError gets raised when required Encrypt response
|
||||||
payload attributes are missing when encoding the payload.
|
payload attributes are missing when encoding the payload.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload()
|
payload = payloads.EncryptResponsePayload()
|
||||||
self.assertIsNone(payload.unique_identifier)
|
self.assertIsNone(payload.unique_identifier)
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
args = (stream, )
|
args = (stream, )
|
||||||
|
@ -912,7 +912,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
*args
|
*args
|
||||||
)
|
)
|
||||||
|
|
||||||
payload = encrypt.EncryptResponsePayload(
|
payload = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959'
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959'
|
||||||
)
|
)
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
|
@ -929,18 +929,18 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
Encrypt response payloads with the same data.
|
Encrypt response payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptResponsePayload()
|
a = payloads.EncryptResponsePayload()
|
||||||
b = encrypt.EncryptResponsePayload()
|
b = payloads.EncryptResponsePayload()
|
||||||
|
|
||||||
self.assertTrue(a == b)
|
self.assertTrue(a == b)
|
||||||
self.assertTrue(b == a)
|
self.assertTrue(b == a)
|
||||||
|
|
||||||
a = encrypt.EncryptResponsePayload(
|
a = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
)
|
)
|
||||||
b = encrypt.EncryptResponsePayload(
|
b = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
|
@ -954,10 +954,10 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Encrypt response payloads with different unique identifiers.
|
Encrypt response payloads with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptResponsePayload(
|
a = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='a'
|
unique_identifier='a'
|
||||||
)
|
)
|
||||||
b = encrypt.EncryptResponsePayload(
|
b = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='b'
|
unique_identifier='b'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -969,8 +969,8 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Encrypt response payloads with different data.
|
Encrypt response payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptResponsePayload(data=b'\x11')
|
a = payloads.EncryptResponsePayload(data=b'\x11')
|
||||||
b = encrypt.EncryptResponsePayload(data=b'\xFF')
|
b = payloads.EncryptResponsePayload(data=b'\xFF')
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
@ -980,8 +980,8 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Encrypt response payloads with different IV/counter/nonce values.
|
Encrypt response payloads with different IV/counter/nonce values.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptResponsePayload(iv_counter_nonce=b'\x22')
|
a = payloads.EncryptResponsePayload(iv_counter_nonce=b'\x22')
|
||||||
b = encrypt.EncryptResponsePayload(iv_counter_nonce=b'\xAA')
|
b = payloads.EncryptResponsePayload(iv_counter_nonce=b'\xAA')
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
@ -991,7 +991,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
Encrypt response payloads with different types.
|
Encrypt response payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptResponsePayload()
|
a = payloads.EncryptResponsePayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
|
@ -1002,18 +1002,18 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing two
|
Test that the inequality operator returns False when comparing two
|
||||||
Encrypt response payloads with the same data.
|
Encrypt response payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptResponsePayload()
|
a = payloads.EncryptResponsePayload()
|
||||||
b = encrypt.EncryptResponsePayload()
|
b = payloads.EncryptResponsePayload()
|
||||||
|
|
||||||
self.assertFalse(a != b)
|
self.assertFalse(a != b)
|
||||||
self.assertFalse(b != a)
|
self.assertFalse(b != a)
|
||||||
|
|
||||||
a = encrypt.EncryptResponsePayload(
|
a = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
)
|
)
|
||||||
b = encrypt.EncryptResponsePayload(
|
b = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
|
@ -1027,10 +1027,10 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Encrypt response payloads with different unique identifiers.
|
Encrypt response payloads with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptResponsePayload(
|
a = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='a'
|
unique_identifier='a'
|
||||||
)
|
)
|
||||||
b = encrypt.EncryptResponsePayload(
|
b = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='b'
|
unique_identifier='b'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1042,8 +1042,8 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Encrypt response payloads with different data.
|
Encrypt response payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptResponsePayload(data=b'\x11')
|
a = payloads.EncryptResponsePayload(data=b'\x11')
|
||||||
b = encrypt.EncryptResponsePayload(data=b'\xFF')
|
b = payloads.EncryptResponsePayload(data=b'\xFF')
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
@ -1053,8 +1053,8 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Encrypt response payloads with different IV/counter/nonce values.
|
Encrypt response payloads with different IV/counter/nonce values.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptResponsePayload(iv_counter_nonce=b'\x22')
|
a = payloads.EncryptResponsePayload(iv_counter_nonce=b'\x22')
|
||||||
b = encrypt.EncryptResponsePayload(iv_counter_nonce=b'\xAA')
|
b = payloads.EncryptResponsePayload(iv_counter_nonce=b'\xAA')
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
@ -1064,7 +1064,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
Encrypt response payloads with different types.
|
Encrypt response payloads with different types.
|
||||||
"""
|
"""
|
||||||
a = encrypt.EncryptResponsePayload()
|
a = payloads.EncryptResponsePayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
|
@ -1074,7 +1074,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that repr can be applied to an Encrypt response payload.
|
Test that repr can be applied to an Encrypt response payload.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload(
|
payload = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
|
@ -1093,7 +1093,7 @@ class TestEncryptResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that str can be applied to an Encrypt response payload
|
Test that str can be applied to an Encrypt response payload
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload(
|
payload = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
unique_identifier='b4faee10-aa2a-4446-8ad4-0881f3422959',
|
||||||
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
data=b'\x01\x23\x45\x67\x89\xAB\xCD\xEF',
|
||||||
iv_counter_nonce=b'\x01'
|
iv_counter_nonce=b'\x01'
|
||||||
|
|
|
@ -22,7 +22,7 @@ from kmip.core import objects
|
||||||
from kmip.core import secrets
|
from kmip.core import secrets
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
|
|
||||||
from kmip.core.messages.payloads import get
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestGetRequestPayload(testtools.TestCase):
|
class TestGetRequestPayload(testtools.TestCase):
|
||||||
|
@ -95,7 +95,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a Get request payload can be constructed with no arguments.
|
Test that a Get request payload can be constructed with no arguments.
|
||||||
"""
|
"""
|
||||||
payload = get.GetRequestPayload()
|
payload = payloads.GetRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.key_format_type)
|
self.assertEqual(None, payload.key_format_type)
|
||||||
|
@ -106,7 +106,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a Get request payload can be constructed with valid values.
|
Test that a Get request payload can be constructed with valid values.
|
||||||
"""
|
"""
|
||||||
payload = get.GetRequestPayload(
|
payload = payloads.GetRequestPayload(
|
||||||
unique_identifier='00000000-2222-4444-6666-888888888888',
|
unique_identifier='00000000-2222-4444-6666-888888888888',
|
||||||
key_format_type=enums.KeyFormatType.RAW,
|
key_format_type=enums.KeyFormatType.RAW,
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
|
@ -143,11 +143,11 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"Unique identifier must be a string.",
|
"Unique identifier must be a string.",
|
||||||
get.GetRequestPayload,
|
payloads.GetRequestPayload,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
args = (get.GetRequestPayload(), 'unique_identifier', 0)
|
args = (payloads.GetRequestPayload(), 'unique_identifier', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"Unique identifier must be a string.",
|
"Unique identifier must be a string.",
|
||||||
|
@ -164,11 +164,11 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"Key format type must be a KeyFormatType enumeration.",
|
"Key format type must be a KeyFormatType enumeration.",
|
||||||
get.GetRequestPayload,
|
payloads.GetRequestPayload,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
args = (get.GetRequestPayload(), 'key_format_type', 'invalid')
|
args = (payloads.GetRequestPayload(), 'key_format_type', 'invalid')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"Key format type must be a KeyFormatType enumeration.",
|
"Key format type must be a KeyFormatType enumeration.",
|
||||||
|
@ -185,11 +185,15 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"Key compression type must be a KeyCompressionType enumeration.",
|
"Key compression type must be a KeyCompressionType enumeration.",
|
||||||
get.GetRequestPayload,
|
payloads.GetRequestPayload,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
args = (get.GetRequestPayload(), 'key_compression_type', 'invalid')
|
args = (
|
||||||
|
payloads.GetRequestPayload(),
|
||||||
|
'key_compression_type',
|
||||||
|
'invalid'
|
||||||
|
)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"Key compression type must be a KeyCompressionType enumeration.",
|
"Key compression type must be a KeyCompressionType enumeration.",
|
||||||
|
@ -207,12 +211,12 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
TypeError,
|
TypeError,
|
||||||
"Key wrapping specification must be a KeyWrappingSpecification "
|
"Key wrapping specification must be a KeyWrappingSpecification "
|
||||||
"struct.",
|
"struct.",
|
||||||
get.GetRequestPayload,
|
payloads.GetRequestPayload,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
args = (
|
args = (
|
||||||
get.GetRequestPayload(),
|
payloads.GetRequestPayload(),
|
||||||
'key_wrapping_specification',
|
'key_wrapping_specification',
|
||||||
'invalid'
|
'invalid'
|
||||||
)
|
)
|
||||||
|
@ -228,7 +232,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a GetRequestPayload struct can be read from a data stream.
|
Test that a GetRequestPayload struct can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get.GetRequestPayload()
|
payload = payloads.GetRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.key_format_type)
|
self.assertEqual(None, payload.key_format_type)
|
||||||
|
@ -282,7 +286,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that a GetRequestPayload struct can be read from a partial data
|
Test that a GetRequestPayload struct can be read from a partial data
|
||||||
stream.
|
stream.
|
||||||
"""
|
"""
|
||||||
payload = get.GetRequestPayload()
|
payload = payloads.GetRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.key_format_type)
|
self.assertEqual(None, payload.key_format_type)
|
||||||
|
@ -304,7 +308,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that a GetRequestPayload struct can be read from an empty data
|
Test that a GetRequestPayload struct can be read from an empty data
|
||||||
stream.
|
stream.
|
||||||
"""
|
"""
|
||||||
payload = get.GetRequestPayload()
|
payload = payloads.GetRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
self.assertEqual(None, payload.key_format_type)
|
self.assertEqual(None, payload.key_format_type)
|
||||||
|
@ -322,7 +326,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a GetRequestPayload struct can be written to a data stream.
|
Test that a GetRequestPayload struct can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get.GetRequestPayload(
|
payload = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
key_format_type=enums.KeyFormatType.RAW,
|
key_format_type=enums.KeyFormatType.RAW,
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
|
@ -351,7 +355,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that a partially defined GetRequestPayload struct can be written
|
Test that a partially defined GetRequestPayload struct can be written
|
||||||
to a data stream.
|
to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get.GetRequestPayload(
|
payload = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
||||||
)
|
)
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
|
@ -366,7 +370,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that an empty GetRequestPayload struct can be written to a data
|
Test that an empty GetRequestPayload struct can be written to a data
|
||||||
stream.
|
stream.
|
||||||
"""
|
"""
|
||||||
payload = get.GetRequestPayload()
|
payload = payloads.GetRequestPayload()
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
|
|
||||||
payload.write(stream)
|
payload.write(stream)
|
||||||
|
@ -379,13 +383,13 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
GetRequestPayload structs with the same data.
|
GetRequestPayload structs with the same data.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload()
|
a = payloads.GetRequestPayload()
|
||||||
b = get.GetRequestPayload()
|
b = payloads.GetRequestPayload()
|
||||||
|
|
||||||
self.assertTrue(a == b)
|
self.assertTrue(a == b)
|
||||||
self.assertTrue(b == a)
|
self.assertTrue(b == a)
|
||||||
|
|
||||||
a = get.GetRequestPayload(
|
a = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
key_format_type=enums.KeyFormatType.RAW,
|
key_format_type=enums.KeyFormatType.RAW,
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
|
@ -402,7 +406,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
encoding_option=enums.EncodingOption.NO_ENCODING
|
encoding_option=enums.EncodingOption.NO_ENCODING
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = get.GetRequestPayload(
|
b = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
key_format_type=enums.KeyFormatType.RAW,
|
key_format_type=enums.KeyFormatType.RAW,
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
|
@ -428,10 +432,10 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetRequestPayload structs with different unique identifiers.
|
GetRequestPayload structs with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload(
|
a = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
||||||
)
|
)
|
||||||
b = get.GetRequestPayload(
|
b = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c303f'
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c303f'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -443,10 +447,10 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetRequestPayload structs with different key format types.
|
GetRequestPayload structs with different key format types.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload(
|
a = payloads.GetRequestPayload(
|
||||||
key_format_type=enums.KeyFormatType.RAW
|
key_format_type=enums.KeyFormatType.RAW
|
||||||
)
|
)
|
||||||
b = get.GetRequestPayload(
|
b = payloads.GetRequestPayload(
|
||||||
key_format_type=enums.KeyFormatType.OPAQUE
|
key_format_type=enums.KeyFormatType.OPAQUE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -458,11 +462,11 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetRequestPayload structs with different key compression types.
|
GetRequestPayload structs with different key compression types.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload(
|
a = payloads.GetRequestPayload(
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
EC_PUBLIC_KEY_TYPE_UNCOMPRESSED
|
EC_PUBLIC_KEY_TYPE_UNCOMPRESSED
|
||||||
)
|
)
|
||||||
b = get.GetRequestPayload(
|
b = payloads.GetRequestPayload(
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
EC_PUBLIC_KEY_TYPE_X9_62_HYBRID
|
EC_PUBLIC_KEY_TYPE_X9_62_HYBRID
|
||||||
)
|
)
|
||||||
|
@ -475,7 +479,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetRequestPayload structs with different key wrapping specifications.
|
GetRequestPayload structs with different key wrapping specifications.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload(
|
a = payloads.GetRequestPayload(
|
||||||
key_wrapping_specification=objects.KeyWrappingSpecification(
|
key_wrapping_specification=objects.KeyWrappingSpecification(
|
||||||
wrapping_method=enums.WrappingMethod.ENCRYPT_THEN_MAC_SIGN,
|
wrapping_method=enums.WrappingMethod.ENCRYPT_THEN_MAC_SIGN,
|
||||||
encryption_key_information=objects.EncryptionKeyInformation(
|
encryption_key_information=objects.EncryptionKeyInformation(
|
||||||
|
@ -488,7 +492,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
encoding_option=enums.EncodingOption.NO_ENCODING
|
encoding_option=enums.EncodingOption.NO_ENCODING
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = get.GetRequestPayload(
|
b = payloads.GetRequestPayload(
|
||||||
key_wrapping_specification=objects.KeyWrappingSpecification(
|
key_wrapping_specification=objects.KeyWrappingSpecification(
|
||||||
wrapping_method=enums.WrappingMethod.ENCRYPT,
|
wrapping_method=enums.WrappingMethod.ENCRYPT,
|
||||||
encryption_key_information=objects.EncryptionKeyInformation(
|
encryption_key_information=objects.EncryptionKeyInformation(
|
||||||
|
@ -510,7 +514,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetRequestPayload structs with different types.
|
GetRequestPayload structs with different types.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload()
|
a = payloads.GetRequestPayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
|
@ -521,13 +525,13 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing two
|
Test that the inequality operator returns False when comparing two
|
||||||
GetRequestPayload structs with the same data.
|
GetRequestPayload structs with the same data.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload()
|
a = payloads.GetRequestPayload()
|
||||||
b = get.GetRequestPayload()
|
b = payloads.GetRequestPayload()
|
||||||
|
|
||||||
self.assertFalse(a != b)
|
self.assertFalse(a != b)
|
||||||
self.assertFalse(b != a)
|
self.assertFalse(b != a)
|
||||||
|
|
||||||
a = get.GetRequestPayload(
|
a = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
key_format_type=enums.KeyFormatType.RAW,
|
key_format_type=enums.KeyFormatType.RAW,
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
|
@ -544,7 +548,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
encoding_option=enums.EncodingOption.NO_ENCODING
|
encoding_option=enums.EncodingOption.NO_ENCODING
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = get.GetRequestPayload(
|
b = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
key_format_type=enums.KeyFormatType.RAW,
|
key_format_type=enums.KeyFormatType.RAW,
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
|
@ -570,10 +574,10 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetRequestPayload structs with different unique identifiers.
|
GetRequestPayload structs with different unique identifiers.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload(
|
a = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
||||||
)
|
)
|
||||||
b = get.GetRequestPayload(
|
b = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c303f'
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c303f'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -585,10 +589,10 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetRequestPayload structs with different key format types.
|
GetRequestPayload structs with different key format types.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload(
|
a = payloads.GetRequestPayload(
|
||||||
key_format_type=enums.KeyFormatType.RAW
|
key_format_type=enums.KeyFormatType.RAW
|
||||||
)
|
)
|
||||||
b = get.GetRequestPayload(
|
b = payloads.GetRequestPayload(
|
||||||
key_format_type=enums.KeyFormatType.OPAQUE
|
key_format_type=enums.KeyFormatType.OPAQUE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -600,11 +604,11 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetRequestPayload structs with different key compression types.
|
GetRequestPayload structs with different key compression types.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload(
|
a = payloads.GetRequestPayload(
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
EC_PUBLIC_KEY_TYPE_UNCOMPRESSED
|
EC_PUBLIC_KEY_TYPE_UNCOMPRESSED
|
||||||
)
|
)
|
||||||
b = get.GetRequestPayload(
|
b = payloads.GetRequestPayload(
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
EC_PUBLIC_KEY_TYPE_X9_62_HYBRID
|
EC_PUBLIC_KEY_TYPE_X9_62_HYBRID
|
||||||
)
|
)
|
||||||
|
@ -617,7 +621,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetRequestPayload structs with different key wrapping specifications.
|
GetRequestPayload structs with different key wrapping specifications.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload(
|
a = payloads.GetRequestPayload(
|
||||||
key_wrapping_specification=objects.KeyWrappingSpecification(
|
key_wrapping_specification=objects.KeyWrappingSpecification(
|
||||||
wrapping_method=enums.WrappingMethod.ENCRYPT_THEN_MAC_SIGN,
|
wrapping_method=enums.WrappingMethod.ENCRYPT_THEN_MAC_SIGN,
|
||||||
encryption_key_information=objects.EncryptionKeyInformation(
|
encryption_key_information=objects.EncryptionKeyInformation(
|
||||||
|
@ -630,7 +634,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
encoding_option=enums.EncodingOption.NO_ENCODING
|
encoding_option=enums.EncodingOption.NO_ENCODING
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = get.GetRequestPayload(
|
b = payloads.GetRequestPayload(
|
||||||
key_wrapping_specification=objects.KeyWrappingSpecification(
|
key_wrapping_specification=objects.KeyWrappingSpecification(
|
||||||
wrapping_method=enums.WrappingMethod.ENCRYPT,
|
wrapping_method=enums.WrappingMethod.ENCRYPT,
|
||||||
encryption_key_information=objects.EncryptionKeyInformation(
|
encryption_key_information=objects.EncryptionKeyInformation(
|
||||||
|
@ -652,7 +656,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetRequestPayload structs with different types.
|
GetRequestPayload structs with different types.
|
||||||
"""
|
"""
|
||||||
a = get.GetRequestPayload()
|
a = payloads.GetRequestPayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
|
@ -662,7 +666,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that repr can be applied to a GetRequestPayload struct.
|
Test that repr can be applied to a GetRequestPayload struct.
|
||||||
"""
|
"""
|
||||||
payload = get.GetRequestPayload(
|
payload = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
key_format_type=enums.KeyFormatType.RAW,
|
key_format_type=enums.KeyFormatType.RAW,
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
|
@ -717,7 +721,7 @@ class TestGetRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that str can be applied to a GetRequestPayload struct.
|
Test that str can be applied to a GetRequestPayload struct.
|
||||||
"""
|
"""
|
||||||
payload = get.GetRequestPayload(
|
payload = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
key_format_type=enums.KeyFormatType.RAW,
|
key_format_type=enums.KeyFormatType.RAW,
|
||||||
key_compression_type=enums.KeyCompressionType.
|
key_compression_type=enums.KeyCompressionType.
|
||||||
|
@ -844,7 +848,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that a GetRequestPayload struct can be constructed with no
|
Test that a GetRequestPayload struct can be constructed with no
|
||||||
arguments.
|
arguments.
|
||||||
"""
|
"""
|
||||||
payload = get.GetResponsePayload()
|
payload = payloads.GetResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.object_type)
|
self.assertEqual(None, payload.object_type)
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
|
@ -855,7 +859,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that a GetRequestPayload struct can be constructed with valid
|
Test that a GetRequestPayload struct can be constructed with valid
|
||||||
values.
|
values.
|
||||||
"""
|
"""
|
||||||
payload = get.GetResponsePayload(
|
payload = payloads.GetResponsePayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifier='11111111-3333-5555-7777-999999999999',
|
unique_identifier='11111111-3333-5555-7777-999999999999',
|
||||||
secret=secrets.SymmetricKey(
|
secret=secrets.SymmetricKey(
|
||||||
|
@ -938,11 +942,11 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"Object type must be an ObjectType enumeration.",
|
"Object type must be an ObjectType enumeration.",
|
||||||
get.GetResponsePayload,
|
payloads.GetResponsePayload,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
args = (get.GetResponsePayload(), 'object_type', 'invalid')
|
args = (payloads.GetResponsePayload(), 'object_type', 'invalid')
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"Object type must be an ObjectType enumeration.",
|
"Object type must be an ObjectType enumeration.",
|
||||||
|
@ -959,11 +963,11 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"Unique identifier must be a string.",
|
"Unique identifier must be a string.",
|
||||||
get.GetResponsePayload,
|
payloads.GetResponsePayload,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
args = (get.GetResponsePayload(), 'unique_identifier', 0)
|
args = (payloads.GetResponsePayload(), 'unique_identifier', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"Unique identifier must be a string.",
|
"Unique identifier must be a string.",
|
||||||
|
@ -982,11 +986,11 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
"Secret must be one of the following structs: Certificate, "
|
"Secret must be one of the following structs: Certificate, "
|
||||||
"OpaqueObject, PrivateKey, PublicKey, SecretData, SplitKey, "
|
"OpaqueObject, PrivateKey, PublicKey, SecretData, SplitKey, "
|
||||||
"SymmetricKey, Template",
|
"SymmetricKey, Template",
|
||||||
get.GetResponsePayload,
|
payloads.GetResponsePayload,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
args = (get.GetResponsePayload(), 'secret', 0)
|
args = (payloads.GetResponsePayload(), 'secret', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"Secret must be one of the following structs: Certificate, "
|
"Secret must be one of the following structs: Certificate, "
|
||||||
|
@ -1000,7 +1004,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a GetResponsePayload struct can be read from a data stream.
|
Test that a GetResponsePayload struct can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get.GetResponsePayload()
|
payload = payloads.GetResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload.object_type)
|
self.assertEqual(None, payload.object_type)
|
||||||
self.assertEqual(None, payload.unique_identifier)
|
self.assertEqual(None, payload.unique_identifier)
|
||||||
|
@ -1061,7 +1065,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when a required GetResponsePayload
|
Test that a ValueError gets raised when a required GetResponsePayload
|
||||||
field is missing when decoding the struct.
|
field is missing when decoding the struct.
|
||||||
"""
|
"""
|
||||||
payload = get.GetResponsePayload()
|
payload = payloads.GetResponsePayload()
|
||||||
args = (self.partial_encoding_missing_object_type, )
|
args = (self.partial_encoding_missing_object_type, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
ValueError,
|
ValueError,
|
||||||
|
@ -1075,7 +1079,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when a required GetResponsePayload
|
Test that a ValueError gets raised when a required GetResponsePayload
|
||||||
field is missing when decoding the struct.
|
field is missing when decoding the struct.
|
||||||
"""
|
"""
|
||||||
payload = get.GetResponsePayload()
|
payload = payloads.GetResponsePayload()
|
||||||
args = (self.partial_encoding_missing_unique_id, )
|
args = (self.partial_encoding_missing_unique_id, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
ValueError,
|
ValueError,
|
||||||
|
@ -1089,7 +1093,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when a required GetResponsePayload
|
Test that a ValueError gets raised when a required GetResponsePayload
|
||||||
field is missing when decoding the struct.
|
field is missing when decoding the struct.
|
||||||
"""
|
"""
|
||||||
payload = get.GetResponsePayload()
|
payload = payloads.GetResponsePayload()
|
||||||
args = (self.partial_encoding_missing_secret, )
|
args = (self.partial_encoding_missing_secret, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
ValueError,
|
ValueError,
|
||||||
|
@ -1102,7 +1106,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a GetResponsePayload struct can be written to a data stream.
|
Test that a GetResponsePayload struct can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get.GetResponsePayload(
|
payload = payloads.GetResponsePayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
secret=secrets.SymmetricKey(
|
secret=secrets.SymmetricKey(
|
||||||
|
@ -1135,7 +1139,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when a required GetResponsePayload
|
Test that a ValueError gets raised when a required GetResponsePayload
|
||||||
field is missing when encoding the struct.
|
field is missing when encoding the struct.
|
||||||
"""
|
"""
|
||||||
payload = get.GetResponsePayload()
|
payload = payloads.GetResponsePayload()
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
args = (stream, )
|
args = (stream, )
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
|
@ -1150,7 +1154,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when a required GetResponsePayload
|
Test that a ValueError gets raised when a required GetResponsePayload
|
||||||
field is missing when encoding the struct.
|
field is missing when encoding the struct.
|
||||||
"""
|
"""
|
||||||
payload = get.GetResponsePayload(
|
payload = payloads.GetResponsePayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY
|
object_type=enums.ObjectType.SYMMETRIC_KEY
|
||||||
)
|
)
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
|
@ -1167,7 +1171,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that a ValueError gets raised when a required GetResponsePayload
|
Test that a ValueError gets raised when a required GetResponsePayload
|
||||||
field is missing when encoding the struct.
|
field is missing when encoding the struct.
|
||||||
"""
|
"""
|
||||||
payload = get.GetResponsePayload(
|
payload = payloads.GetResponsePayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
||||||
)
|
)
|
||||||
|
@ -1185,8 +1189,8 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
GetResponsePayload structs with the same data.
|
GetResponsePayload structs with the same data.
|
||||||
"""
|
"""
|
||||||
a = get.GetResponsePayload()
|
a = payloads.GetResponsePayload()
|
||||||
b = get.GetResponsePayload()
|
b = payloads.GetResponsePayload()
|
||||||
|
|
||||||
self.assertTrue(a == b)
|
self.assertTrue(a == b)
|
||||||
self.assertTrue(b == a)
|
self.assertTrue(b == a)
|
||||||
|
@ -1212,12 +1216,12 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
a = get.GetResponsePayload(
|
a = payloads.GetResponsePayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
secret=secret
|
secret=secret
|
||||||
)
|
)
|
||||||
b = get.GetResponsePayload(
|
b = payloads.GetResponsePayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
secret=secret
|
secret=secret
|
||||||
|
@ -1231,8 +1235,12 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetResponsePayload structs with different object type fields.
|
GetResponsePayload structs with different object type fields.
|
||||||
"""
|
"""
|
||||||
a = get.GetResponsePayload(object_type=enums.ObjectType.SYMMETRIC_KEY)
|
a = payloads.GetResponsePayload(
|
||||||
b = get.GetResponsePayload(object_type=enums.ObjectType.OPAQUE_DATA)
|
object_type=enums.ObjectType.SYMMETRIC_KEY
|
||||||
|
)
|
||||||
|
b = payloads.GetResponsePayload(
|
||||||
|
object_type=enums.ObjectType.OPAQUE_DATA
|
||||||
|
)
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
self.assertFalse(b == a)
|
self.assertFalse(b == a)
|
||||||
|
@ -1242,10 +1250,10 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetResponsePayload structs with different unique identifier fields.
|
GetResponsePayload structs with different unique identifier fields.
|
||||||
"""
|
"""
|
||||||
a = get.GetResponsePayload(
|
a = payloads.GetResponsePayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
||||||
)
|
)
|
||||||
b = get.GetResponsePayload(
|
b = payloads.GetResponsePayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-ffff-7e58802c3038'
|
unique_identifier='49a1ca88-6bea-4fb2-ffff-7e58802c3038'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1259,7 +1267,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
# TODO (peter-hamilton): Update this test case once SymmetricKeys
|
# TODO (peter-hamilton): Update this test case once SymmetricKeys
|
||||||
# support proper field-based equality.
|
# support proper field-based equality.
|
||||||
a = get.GetResponsePayload(
|
a = payloads.GetResponsePayload(
|
||||||
secret=secrets.SymmetricKey(
|
secret=secrets.SymmetricKey(
|
||||||
key_block=objects.KeyBlock(
|
key_block=objects.KeyBlock(
|
||||||
key_format_type=misc.KeyFormatType(
|
key_format_type=misc.KeyFormatType(
|
||||||
|
@ -1279,7 +1287,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = get.GetResponsePayload(
|
b = payloads.GetResponsePayload(
|
||||||
secret=secrets.SymmetricKey(
|
secret=secrets.SymmetricKey(
|
||||||
key_block=objects.KeyBlock(
|
key_block=objects.KeyBlock(
|
||||||
key_format_type=misc.KeyFormatType(
|
key_format_type=misc.KeyFormatType(
|
||||||
|
@ -1308,7 +1316,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operators returns False when comparing two
|
Test that the equality operators returns False when comparing two
|
||||||
GetResponsePayload structs with different types.
|
GetResponsePayload structs with different types.
|
||||||
"""
|
"""
|
||||||
a = get.GetResponsePayload()
|
a = payloads.GetResponsePayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertFalse(a == b)
|
self.assertFalse(a == b)
|
||||||
|
@ -1319,8 +1327,8 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing two
|
Test that the inequality operator returns False when comparing two
|
||||||
GetResponsePayload structs with the same data.
|
GetResponsePayload structs with the same data.
|
||||||
"""
|
"""
|
||||||
a = get.GetResponsePayload()
|
a = payloads.GetResponsePayload()
|
||||||
b = get.GetResponsePayload()
|
b = payloads.GetResponsePayload()
|
||||||
|
|
||||||
self.assertFalse(a != b)
|
self.assertFalse(a != b)
|
||||||
self.assertFalse(b != a)
|
self.assertFalse(b != a)
|
||||||
|
@ -1344,12 +1352,12 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
a = get.GetResponsePayload(
|
a = payloads.GetResponsePayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
secret=secret
|
secret=secret
|
||||||
)
|
)
|
||||||
b = get.GetResponsePayload(
|
b = payloads.GetResponsePayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
secret=secret
|
secret=secret
|
||||||
|
@ -1363,8 +1371,12 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetResponsePayload structs with different object type fields.
|
GetResponsePayload structs with different object type fields.
|
||||||
"""
|
"""
|
||||||
a = get.GetResponsePayload(object_type=enums.ObjectType.SYMMETRIC_KEY)
|
a = payloads.GetResponsePayload(
|
||||||
b = get.GetResponsePayload(object_type=enums.ObjectType.OPAQUE_DATA)
|
object_type=enums.ObjectType.SYMMETRIC_KEY
|
||||||
|
)
|
||||||
|
b = payloads.GetResponsePayload(
|
||||||
|
object_type=enums.ObjectType.OPAQUE_DATA
|
||||||
|
)
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
self.assertTrue(b != a)
|
self.assertTrue(b != a)
|
||||||
|
@ -1374,10 +1386,10 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetResponsePayload structs with different unique identifier fields.
|
GetResponsePayload structs with different unique identifier fields.
|
||||||
"""
|
"""
|
||||||
a = get.GetResponsePayload(
|
a = payloads.GetResponsePayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
||||||
)
|
)
|
||||||
b = get.GetResponsePayload(
|
b = payloads.GetResponsePayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-ffff-7e58802c3038'
|
unique_identifier='49a1ca88-6bea-4fb2-ffff-7e58802c3038'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1391,7 +1403,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
# TODO (peter-hamilton): Update this test case once SymmetricKeys
|
# TODO (peter-hamilton): Update this test case once SymmetricKeys
|
||||||
# support proper field-based equality.
|
# support proper field-based equality.
|
||||||
a = get.GetResponsePayload(
|
a = payloads.GetResponsePayload(
|
||||||
secret=secrets.SymmetricKey(
|
secret=secrets.SymmetricKey(
|
||||||
key_block=objects.KeyBlock(
|
key_block=objects.KeyBlock(
|
||||||
key_format_type=misc.KeyFormatType(
|
key_format_type=misc.KeyFormatType(
|
||||||
|
@ -1411,7 +1423,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
b = get.GetResponsePayload(
|
b = payloads.GetResponsePayload(
|
||||||
secret=secrets.SymmetricKey(
|
secret=secrets.SymmetricKey(
|
||||||
key_block=objects.KeyBlock(
|
key_block=objects.KeyBlock(
|
||||||
key_format_type=misc.KeyFormatType(
|
key_format_type=misc.KeyFormatType(
|
||||||
|
@ -1440,7 +1452,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operators returns True when comparing two
|
Test that the inequality operators returns True when comparing two
|
||||||
GetResponsePayload structs with different types.
|
GetResponsePayload structs with different types.
|
||||||
"""
|
"""
|
||||||
a = get.GetResponsePayload()
|
a = payloads.GetResponsePayload()
|
||||||
b = 'invalid'
|
b = 'invalid'
|
||||||
|
|
||||||
self.assertTrue(a != b)
|
self.assertTrue(a != b)
|
||||||
|
@ -1450,7 +1462,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that repr can be applied to a GetResponsePayload struct.
|
Test that repr can be applied to a GetResponsePayload struct.
|
||||||
"""
|
"""
|
||||||
payload = get.GetResponsePayload(
|
payload = payloads.GetResponsePayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
secret=secrets.SymmetricKey(
|
secret=secrets.SymmetricKey(
|
||||||
|
@ -1506,7 +1518,7 @@ class TestGetResponsePayload(testtools.TestCase):
|
||||||
cryptographic_length=attributes.CryptographicLength(168)
|
cryptographic_length=attributes.CryptographicLength(168)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
payload = get.GetResponsePayload(
|
payload = payloads.GetResponsePayload(
|
||||||
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
object_type=enums.ObjectType.SYMMETRIC_KEY,
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038',
|
||||||
secret=secret
|
secret=secret
|
||||||
|
|
|
@ -19,7 +19,7 @@ from kmip.core import enums
|
||||||
from kmip.core import primitives
|
from kmip.core import primitives
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
|
|
||||||
from kmip.core.messages.payloads import get_attribute_list
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestGetAttributeListRequestPayload(testtools.TestCase):
|
class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
|
@ -52,14 +52,14 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList request payload can be constructed with
|
Test that a GetAttributeList request payload can be constructed with
|
||||||
no arguments.
|
no arguments.
|
||||||
"""
|
"""
|
||||||
get_attribute_list.GetAttributeListRequestPayload()
|
payloads.GetAttributeListRequestPayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
"""
|
"""
|
||||||
Test that a GetAttributeList request payload can be constructed with a
|
Test that a GetAttributeList request payload can be constructed with a
|
||||||
valid value.
|
valid value.
|
||||||
"""
|
"""
|
||||||
get_attribute_list.GetAttributeListRequestPayload(
|
payloads.GetAttributeListRequestPayload(
|
||||||
'test-unique-identifier',
|
'test-unique-identifier',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that the unique_identifier attribute of a GetAttributeList
|
Test that the unique_identifier attribute of a GetAttributeList
|
||||||
request payload can be properly set and retrieved.
|
request payload can be properly set and retrieved.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListRequestPayload()
|
payload = payloads.GetAttributeListRequestPayload()
|
||||||
|
|
||||||
self.assertIsNone(payload.unique_identifier)
|
self.assertIsNone(payload.unique_identifier)
|
||||||
self.assertIsNone(payload._unique_identifier)
|
self.assertIsNone(payload._unique_identifier)
|
||||||
|
@ -89,7 +89,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid ID is used to set
|
Test that a TypeError is raised when an invalid ID is used to set
|
||||||
the unique_identifier attribute of a GetAttributeList request payload.
|
the unique_identifier attribute of a GetAttributeList request payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListRequestPayload()
|
payload = payloads.GetAttributeListRequestPayload()
|
||||||
args = (payload, 'unique_identifier', 0)
|
args = (payload, 'unique_identifier', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -103,7 +103,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList request payload can be read from a data
|
Test that a GetAttributeList request payload can be read from a data
|
||||||
stream.
|
stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListRequestPayload()
|
payload = payloads.GetAttributeListRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList response payload with no ID or attribute
|
Test that a GetAttributeList response payload with no ID or attribute
|
||||||
names can be read from a data stream.
|
names can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListRequestPayload()
|
payload = payloads.GetAttributeListRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList request payload can be written to a data
|
Test that a GetAttributeList request payload can be written to a data
|
||||||
stream.
|
stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListRequestPayload(
|
payload = payloads.GetAttributeListRequestPayload(
|
||||||
self.unique_identifier
|
self.unique_identifier
|
||||||
)
|
)
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
|
@ -151,7 +151,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList request payload with no ID or attribute
|
Test that a GetAttributeList request payload with no ID or attribute
|
||||||
names can be written to a data stream.
|
names can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListRequestPayload()
|
payload = payloads.GetAttributeListRequestPayload()
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload.write(stream)
|
payload.write(stream)
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that repr can be applied to a GetAttributeList request payload.
|
Test that repr can be applied to a GetAttributeList request payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListRequestPayload(
|
payload = payloads.GetAttributeListRequestPayload(
|
||||||
self.unique_identifier
|
self.unique_identifier
|
||||||
)
|
)
|
||||||
unique_identifier = "unique_identifier={0}".format(
|
unique_identifier = "unique_identifier={0}".format(
|
||||||
|
@ -179,7 +179,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that repr can be applied to a GetAttributeList request payload
|
Test that repr can be applied to a GetAttributeList request payload
|
||||||
with no ID or attribute names.
|
with no ID or attribute names.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListRequestPayload(
|
payload = payloads.GetAttributeListRequestPayload(
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
unique_identifier = "unique_identifier={0}".format(
|
unique_identifier = "unique_identifier={0}".format(
|
||||||
|
@ -195,7 +195,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that str can be applied to a GetAttributeList request payload.
|
Test that str can be applied to a GetAttributeList request payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListRequestPayload(
|
payload = payloads.GetAttributeListRequestPayload(
|
||||||
self.unique_identifier
|
self.unique_identifier
|
||||||
)
|
)
|
||||||
expected = str({
|
expected = str({
|
||||||
|
@ -209,7 +209,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that str can be applied to a GetAttributeList request payload
|
Test that str can be applied to a GetAttributeList request payload
|
||||||
with no ID or attribute names.
|
with no ID or attribute names.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListRequestPayload(
|
payload = payloads.GetAttributeListRequestPayload(
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
expected = str({
|
expected = str({
|
||||||
|
@ -223,10 +223,10 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
GetAttributeList request payloads with the same data.
|
GetAttributeList request payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListRequestPayload(
|
a = payloads.GetAttributeListRequestPayload(
|
||||||
self.unique_identifier
|
self.unique_identifier
|
||||||
)
|
)
|
||||||
b = get_attribute_list.GetAttributeListRequestPayload(
|
b = payloads.GetAttributeListRequestPayload(
|
||||||
self.unique_identifier
|
self.unique_identifier
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -238,10 +238,10 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetAttributeList request payloads with different IDs.
|
GetAttributeList request payloads with different IDs.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListRequestPayload(
|
a = payloads.GetAttributeListRequestPayload(
|
||||||
self.unique_identifier
|
self.unique_identifier
|
||||||
)
|
)
|
||||||
b = get_attribute_list.GetAttributeListRequestPayload(
|
b = payloads.GetAttributeListRequestPayload(
|
||||||
'invalid'
|
'invalid'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
GetAttributeList request payload to a non-GetAttributeList request
|
GetAttributeList request payload to a non-GetAttributeList request
|
||||||
payload.
|
payload.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListRequestPayload(
|
a = payloads.GetAttributeListRequestPayload(
|
||||||
self.unique_identifier
|
self.unique_identifier
|
||||||
)
|
)
|
||||||
b = "invalid"
|
b = "invalid"
|
||||||
|
@ -267,10 +267,10 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing
|
Test that the inequality operator returns False when comparing
|
||||||
two GetAttributeList request payloads with the same internal data.
|
two GetAttributeList request payloads with the same internal data.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListRequestPayload(
|
a = payloads.GetAttributeListRequestPayload(
|
||||||
self.unique_identifier
|
self.unique_identifier
|
||||||
)
|
)
|
||||||
b = get_attribute_list.GetAttributeListRequestPayload(
|
b = payloads.GetAttributeListRequestPayload(
|
||||||
self.unique_identifier
|
self.unique_identifier
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -282,10 +282,10 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetAttributeList request payloads with different IDs.
|
GetAttributeList request payloads with different IDs.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListRequestPayload(
|
a = payloads.GetAttributeListRequestPayload(
|
||||||
self.unique_identifier
|
self.unique_identifier
|
||||||
)
|
)
|
||||||
b = get_attribute_list.GetAttributeListRequestPayload(
|
b = payloads.GetAttributeListRequestPayload(
|
||||||
'invalid'
|
'invalid'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ class TestGetAttributeListRequestPayload(testtools.TestCase):
|
||||||
GetAttributeList request payload to a non-GetAttributeList request
|
GetAttributeList request payload to a non-GetAttributeList request
|
||||||
payload.
|
payload.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListRequestPayload(
|
a = payloads.GetAttributeListRequestPayload(
|
||||||
self.unique_identifier
|
self.unique_identifier
|
||||||
)
|
)
|
||||||
b = "invalid"
|
b = "invalid"
|
||||||
|
@ -398,14 +398,14 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList response payload can be constructed with
|
Test that a GetAttributeList response payload can be constructed with
|
||||||
no arguments.
|
no arguments.
|
||||||
"""
|
"""
|
||||||
get_attribute_list.GetAttributeListResponsePayload()
|
payloads.GetAttributeListResponsePayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
"""
|
"""
|
||||||
Test that a GetAttributeList response payload can be constructed with a
|
Test that a GetAttributeList response payload can be constructed with a
|
||||||
valid value.
|
valid value.
|
||||||
"""
|
"""
|
||||||
get_attribute_list.GetAttributeListResponsePayload(
|
payloads.GetAttributeListResponsePayload(
|
||||||
'test-unique-identifier',
|
'test-unique-identifier',
|
||||||
['test-attribute-name-1', 'test-attribute-name-2']
|
['test-attribute-name-1', 'test-attribute-name-2']
|
||||||
)
|
)
|
||||||
|
@ -415,7 +415,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that the unique_identifier attribute of a GetAttributeList
|
Test that the unique_identifier attribute of a GetAttributeList
|
||||||
response payload can be properly set and retrieved.
|
response payload can be properly set and retrieved.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload()
|
payload = payloads.GetAttributeListResponsePayload()
|
||||||
|
|
||||||
self.assertIsNone(payload.unique_identifier)
|
self.assertIsNone(payload.unique_identifier)
|
||||||
self.assertIsNone(payload._unique_identifier)
|
self.assertIsNone(payload._unique_identifier)
|
||||||
|
@ -437,7 +437,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
the unique_identifier attribute of a GetAttributeList response
|
the unique_identifier attribute of a GetAttributeList response
|
||||||
payload.
|
payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload()
|
payload = payloads.GetAttributeListResponsePayload()
|
||||||
args = (payload, 'unique_identifier', 0)
|
args = (payload, 'unique_identifier', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -451,7 +451,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that the attribute_names attribute of a GetAttributeList response
|
Test that the attribute_names attribute of a GetAttributeList response
|
||||||
payload can be properly set and retrieved.
|
payload can be properly set and retrieved.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload()
|
payload = payloads.GetAttributeListResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(list(), payload.attribute_names)
|
self.assertEqual(list(), payload.attribute_names)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -485,7 +485,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid list is used to set
|
Test that a TypeError is raised when an invalid list is used to set
|
||||||
the attribute_names attribute of a GetAttributeList response payload.
|
the attribute_names attribute of a GetAttributeList response payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload()
|
payload = payloads.GetAttributeListResponsePayload()
|
||||||
args = (payload, 'attribute_names', 0)
|
args = (payload, 'attribute_names', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -500,7 +500,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
included in the list used to set the attribute_names attribute of a
|
included in the list used to set the attribute_names attribute of a
|
||||||
GetAttributeList response payload.
|
GetAttributeList response payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload()
|
payload = payloads.GetAttributeListResponsePayload()
|
||||||
args = (
|
args = (
|
||||||
payload,
|
payload,
|
||||||
'attribute_names',
|
'attribute_names',
|
||||||
|
@ -519,7 +519,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that duplicate attribute names are silently removed when setting
|
Test that duplicate attribute names are silently removed when setting
|
||||||
the attribute_names attribute of a GetAttributeList response payload.
|
the attribute_names attribute of a GetAttributeList response payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload()
|
payload = payloads.GetAttributeListResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(list(), payload.attribute_names)
|
self.assertEqual(list(), payload.attribute_names)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -554,7 +554,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList response payload can be read from a data
|
Test that a GetAttributeList response payload can be read from a data
|
||||||
stream.
|
stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload()
|
payload = payloads.GetAttributeListResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -587,7 +587,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList response payload with no ID can be read
|
Test that a GetAttributeList response payload with no ID can be read
|
||||||
from a data stream.
|
from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload()
|
payload = payloads.GetAttributeListResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -614,7 +614,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList response payload with no attribute names
|
Test that a GetAttributeList response payload with no attribute names
|
||||||
can be read from a data stream.
|
can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload()
|
payload = payloads.GetAttributeListResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -637,7 +637,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList response payload with no ID or attribute
|
Test that a GetAttributeList response payload with no ID or attribute
|
||||||
names can be read from a data stream.
|
names can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload()
|
payload = payloads.GetAttributeListResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -654,7 +654,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList response payload can be written to a data
|
Test that a GetAttributeList response payload can be written to a data
|
||||||
stream.
|
stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -669,7 +669,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList response payload with no ID can be
|
Test that a GetAttributeList response payload with no ID can be
|
||||||
written to a data stream.
|
written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
None,
|
None,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -690,7 +690,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList response payload with no attribute names
|
Test that a GetAttributeList response payload with no attribute names
|
||||||
can be written to a data stream.
|
can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -705,7 +705,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributeList response payload with no ID or attribute
|
Test that a GetAttributeList response payload with no ID or attribute
|
||||||
names can be written to a data stream.
|
names can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload()
|
payload = payloads.GetAttributeListResponsePayload()
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload.write(stream)
|
payload.write(stream)
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that repr can be applied to a GetAttributeList response payload.
|
Test that repr can be applied to a GetAttributeList response payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -738,7 +738,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that repr can be applied to a GetAttributeList response payload
|
Test that repr can be applied to a GetAttributeList response payload
|
||||||
with no ID.
|
with no ID.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
None,
|
None,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -760,7 +760,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that repr can be applied to a GetAttributeList response payload
|
Test that repr can be applied to a GetAttributeList response payload
|
||||||
with no attribute names.
|
with no attribute names.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -782,7 +782,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that repr can be applied to a GetAttributeList response payload
|
Test that repr can be applied to a GetAttributeList response payload
|
||||||
with no ID or attribute names.
|
with no ID or attribute names.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
None,
|
None,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -803,7 +803,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that str can be applied to a GetAttributeList response payload.
|
Test that str can be applied to a GetAttributeList response payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -819,7 +819,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that str can be applied to a GetAttributeList response payload
|
Test that str can be applied to a GetAttributeList response payload
|
||||||
with no ID.
|
with no ID.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
None,
|
None,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -835,7 +835,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that str can be applied to a GetAttributeList response payload
|
Test that str can be applied to a GetAttributeList response payload
|
||||||
with no attribute names.
|
with no attribute names.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -851,7 +851,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that str can be applied to a GetAttributeList response payload
|
Test that str can be applied to a GetAttributeList response payload
|
||||||
with no ID or attribute names.
|
with no ID or attribute names.
|
||||||
"""
|
"""
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
None,
|
None,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -867,11 +867,11 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
GetAttributeList response payloads with the same data.
|
GetAttributeList response payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListResponsePayload(
|
a = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attribute_list.GetAttributeListResponsePayload(
|
b = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -885,12 +885,12 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
GetAttributeList response payload with the same attribute_name sets
|
GetAttributeList response payload with the same attribute_name sets
|
||||||
but with different attribute name orderings.
|
but with different attribute name orderings.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListResponsePayload(
|
a = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
self.attribute_names.reverse()
|
self.attribute_names.reverse()
|
||||||
b = get_attribute_list.GetAttributeListResponsePayload(
|
b = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -903,11 +903,11 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetAttributeList response payloads with different IDs.
|
GetAttributeList response payloads with different IDs.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListResponsePayload(
|
a = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attribute_list.GetAttributeListResponsePayload(
|
b = payloads.GetAttributeListResponsePayload(
|
||||||
'invalid',
|
'invalid',
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -920,11 +920,11 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetAttributeList response payloads with different attribute names.
|
GetAttributeList response payloads with different attribute names.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListResponsePayload(
|
a = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attribute_list.GetAttributeListResponsePayload(
|
b = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -938,7 +938,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
GetAttributeList response payload to a non-GetAttributeList response
|
GetAttributeList response payload to a non-GetAttributeList response
|
||||||
payload.
|
payload.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListResponsePayload(
|
a = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -952,11 +952,11 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing
|
Test that the inequality operator returns False when comparing
|
||||||
two GetAttributeList response payloads with the same internal data.
|
two GetAttributeList response payloads with the same internal data.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListResponsePayload(
|
a = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attribute_list.GetAttributeListResponsePayload(
|
b = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -969,11 +969,11 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetAttributeList response payloads with different IDs.
|
GetAttributeList response payloads with different IDs.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListResponsePayload(
|
a = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attribute_list.GetAttributeListResponsePayload(
|
b = payloads.GetAttributeListResponsePayload(
|
||||||
'invalid',
|
'invalid',
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -986,11 +986,11 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetAttributeList response payloads with different attribute names.
|
GetAttributeList response payloads with different attribute names.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListResponsePayload(
|
a = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attribute_list.GetAttributeListResponsePayload(
|
b = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -1004,7 +1004,7 @@ class TestGetAttributeListResponsePayload(testtools.TestCase):
|
||||||
GetAttributeList response payload to a non-GetAttributeList response
|
GetAttributeList response payload to a non-GetAttributeList response
|
||||||
payload.
|
payload.
|
||||||
"""
|
"""
|
||||||
a = get_attribute_list.GetAttributeListResponsePayload(
|
a = payloads.GetAttributeListResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,7 +20,7 @@ from kmip.core import objects
|
||||||
from kmip.core import primitives
|
from kmip.core import primitives
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
|
|
||||||
from kmip.core.messages.payloads import get_attributes
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestGetAttributesRequestPayload(testtools.TestCase):
|
class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
|
@ -82,14 +82,14 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributes request payload can be constructed with
|
Test that a GetAttributes request payload can be constructed with
|
||||||
no arguments.
|
no arguments.
|
||||||
"""
|
"""
|
||||||
get_attributes.GetAttributesRequestPayload()
|
payloads.GetAttributesRequestPayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
"""
|
"""
|
||||||
Test that a GetAttributes request payload can be constructed with a
|
Test that a GetAttributes request payload can be constructed with a
|
||||||
valid value.
|
valid value.
|
||||||
"""
|
"""
|
||||||
get_attributes.GetAttributesRequestPayload(
|
payloads.GetAttributesRequestPayload(
|
||||||
'test-unique-identifier',
|
'test-unique-identifier',
|
||||||
['test-attribute-name-1', 'test-attribute-name-2']
|
['test-attribute-name-1', 'test-attribute-name-2']
|
||||||
)
|
)
|
||||||
|
@ -99,7 +99,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that the unique_identifier attribute of a GetAttributes request
|
Test that the unique_identifier attribute of a GetAttributes request
|
||||||
payload can be properly set and retrieved.
|
payload can be properly set and retrieved.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload()
|
payload = payloads.GetAttributesRequestPayload()
|
||||||
|
|
||||||
self.assertIsNone(payload.unique_identifier)
|
self.assertIsNone(payload.unique_identifier)
|
||||||
self.assertIsNone(payload._unique_identifier)
|
self.assertIsNone(payload._unique_identifier)
|
||||||
|
@ -120,7 +120,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid ID is used to set
|
Test that a TypeError is raised when an invalid ID is used to set
|
||||||
the unique_identifier attribute of a GetAttributes request payload.
|
the unique_identifier attribute of a GetAttributes request payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload()
|
payload = payloads.GetAttributesRequestPayload()
|
||||||
args = (payload, 'unique_identifier', 0)
|
args = (payload, 'unique_identifier', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -134,7 +134,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that the attribute_names attribute of a GetAttributes request
|
Test that the attribute_names attribute of a GetAttributes request
|
||||||
payload can be properly set and retrieved.
|
payload can be properly set and retrieved.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload()
|
payload = payloads.GetAttributesRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(list(), payload.attribute_names)
|
self.assertEqual(list(), payload.attribute_names)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -168,7 +168,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid list is used to set
|
Test that a TypeError is raised when an invalid list is used to set
|
||||||
the attribute_names attribute of a GetAttributes request payload.
|
the attribute_names attribute of a GetAttributes request payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload()
|
payload = payloads.GetAttributesRequestPayload()
|
||||||
args = (payload, 'attribute_names', 0)
|
args = (payload, 'attribute_names', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -183,7 +183,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
included in the list used to set the attribute_names attribute of a
|
included in the list used to set the attribute_names attribute of a
|
||||||
GetAttributes request payload.
|
GetAttributes request payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload()
|
payload = payloads.GetAttributesRequestPayload()
|
||||||
args = (
|
args = (
|
||||||
payload,
|
payload,
|
||||||
'attribute_names',
|
'attribute_names',
|
||||||
|
@ -202,7 +202,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that duplicate attribute names are silently removed when setting
|
Test that duplicate attribute names are silently removed when setting
|
||||||
the attribute_names attribute of a GetAttributes request payload.
|
the attribute_names attribute of a GetAttributes request payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload()
|
payload = payloads.GetAttributesRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(list(), payload.attribute_names)
|
self.assertEqual(list(), payload.attribute_names)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -237,7 +237,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributes request payload can be read from a data
|
Test that a GetAttributes request payload can be read from a data
|
||||||
stream.
|
stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload()
|
payload = payloads.GetAttributesRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -270,7 +270,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributes request payload with no ID can be read
|
Test that a GetAttributes request payload with no ID can be read
|
||||||
from a data stream.
|
from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload()
|
payload = payloads.GetAttributesRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -297,7 +297,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributes request payload with no attribute names
|
Test that a GetAttributes request payload with no attribute names
|
||||||
can be read from a data stream.
|
can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload()
|
payload = payloads.GetAttributesRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -320,7 +320,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributes request payload with no ID or attribute
|
Test that a GetAttributes request payload with no ID or attribute
|
||||||
names can be read from a data stream.
|
names can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload()
|
payload = payloads.GetAttributesRequestPayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
self.assertEqual(list(), payload._attribute_names)
|
self.assertEqual(list(), payload._attribute_names)
|
||||||
|
@ -337,7 +337,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributes request payload can be written to a data
|
Test that a GetAttributes request payload can be written to a data
|
||||||
stream.
|
stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -352,7 +352,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributes request payload with no ID can be written
|
Test that a GetAttributes request payload with no ID can be written
|
||||||
to a data stream.
|
to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
None,
|
None,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -373,7 +373,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributes request payload with no attribute names
|
Test that a GetAttributes request payload with no attribute names
|
||||||
can be written to a data stream.
|
can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -388,7 +388,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that a GetAttributes request payload with no ID or attribute
|
Test that a GetAttributes request payload with no ID or attribute
|
||||||
names can be written to a data stream.
|
names can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload()
|
payload = payloads.GetAttributesRequestPayload()
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload.write(stream)
|
payload.write(stream)
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that repr can be applied to a GetAttributes request payload.
|
Test that repr can be applied to a GetAttributes request payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -421,7 +421,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that repr can be applied to a GetAttributes request payload with
|
Test that repr can be applied to a GetAttributes request payload with
|
||||||
no ID.
|
no ID.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
None,
|
None,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -443,7 +443,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that repr can be applied to a GetAttributes request payload with
|
Test that repr can be applied to a GetAttributes request payload with
|
||||||
no attribute names.
|
no attribute names.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -465,7 +465,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that repr can be applied to a GetAttributes request payload with
|
Test that repr can be applied to a GetAttributes request payload with
|
||||||
no ID or attribute names.
|
no ID or attribute names.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
None,
|
None,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -486,7 +486,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that str can be applied to a GetAttributes request payload.
|
Test that str can be applied to a GetAttributes request payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -502,7 +502,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that str can be applied to a GetAttributes request payload with
|
Test that str can be applied to a GetAttributes request payload with
|
||||||
no ID.
|
no ID.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
None,
|
None,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -518,7 +518,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that str can be applied to a GetAttributes request payload with
|
Test that str can be applied to a GetAttributes request payload with
|
||||||
no attribute names.
|
no attribute names.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -534,7 +534,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that str can be applied to a GetAttributes request payload with
|
Test that str can be applied to a GetAttributes request payload with
|
||||||
no ID or attribute names.
|
no ID or attribute names.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesRequestPayload(
|
payload = payloads.GetAttributesRequestPayload(
|
||||||
None,
|
None,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -550,11 +550,11 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
GetAttributes request payloads with the same data.
|
GetAttributes request payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesRequestPayload(
|
a = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesRequestPayload(
|
b = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -568,12 +568,12 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
GetAttributes request payload with the same attribute_name sets
|
GetAttributes request payload with the same attribute_name sets
|
||||||
but with different attribute name orderings.
|
but with different attribute name orderings.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesRequestPayload(
|
a = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
self.attribute_names.reverse()
|
self.attribute_names.reverse()
|
||||||
b = get_attributes.GetAttributesRequestPayload(
|
b = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -586,11 +586,11 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetAttributes request payloads with different IDs.
|
GetAttributes request payloads with different IDs.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesRequestPayload(
|
a = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesRequestPayload(
|
b = payloads.GetAttributesRequestPayload(
|
||||||
'invalid',
|
'invalid',
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -603,11 +603,11 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetAttributes request payloads with different attribute names.
|
GetAttributes request payloads with different attribute names.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesRequestPayload(
|
a = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesRequestPayload(
|
b = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -621,7 +621,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
GetAttributes request payload to a non-GetAttributes request
|
GetAttributes request payload to a non-GetAttributes request
|
||||||
payload.
|
payload.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesRequestPayload(
|
a = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -635,11 +635,11 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing
|
Test that the inequality operator returns False when comparing
|
||||||
two GetAttributes request payloads with the same internal data.
|
two GetAttributes request payloads with the same internal data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesRequestPayload(
|
a = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesRequestPayload(
|
b = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -652,11 +652,11 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetAttributes request payloads with different IDs.
|
GetAttributes request payloads with different IDs.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesRequestPayload(
|
a = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesRequestPayload(
|
b = payloads.GetAttributesRequestPayload(
|
||||||
'invalid',
|
'invalid',
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -669,11 +669,11 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetAttributes request payloads with different attribute names.
|
GetAttributes request payloads with different attribute names.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesRequestPayload(
|
a = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesRequestPayload(
|
b = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -687,7 +687,7 @@ class TestGetAttributesRequestPayload(testtools.TestCase):
|
||||||
GetAttributes request payload to a non-GetAttributes request
|
GetAttributes request payload to a non-GetAttributes request
|
||||||
payload.
|
payload.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesRequestPayload(
|
a = payloads.GetAttributesRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attribute_names
|
self.attribute_names
|
||||||
)
|
)
|
||||||
|
@ -791,14 +791,14 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that a GetAttributes response payload can be constructed.
|
Test that a GetAttributes response payload can be constructed.
|
||||||
"""
|
"""
|
||||||
get_attributes.GetAttributesResponsePayload()
|
payloads.GetAttributesResponsePayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
"""
|
"""
|
||||||
Test that a GetAttributes response payload can be constructed with a
|
Test that a GetAttributes response payload can be constructed with a
|
||||||
valid value.
|
valid value.
|
||||||
"""
|
"""
|
||||||
get_attributes.GetAttributesResponsePayload(
|
payloads.GetAttributesResponsePayload(
|
||||||
'test-unique-identifier',
|
'test-unique-identifier',
|
||||||
[objects.Attribute(), objects.Attribute()]
|
[objects.Attribute(), objects.Attribute()]
|
||||||
)
|
)
|
||||||
|
@ -808,7 +808,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the unique_identifier attribute of a GetAttributes response
|
Test that the unique_identifier attribute of a GetAttributes response
|
||||||
payload can be properly set and retrieved.
|
payload can be properly set and retrieved.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload()
|
payload = payloads.GetAttributesResponsePayload()
|
||||||
|
|
||||||
self.assertIsNone(payload.unique_identifier)
|
self.assertIsNone(payload.unique_identifier)
|
||||||
self.assertIsNone(payload._unique_identifier)
|
self.assertIsNone(payload._unique_identifier)
|
||||||
|
@ -829,7 +829,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid ID is used to set
|
Test that a TypeError is raised when an invalid ID is used to set
|
||||||
the unique_identifier attribute of a GetAttributes response payload.
|
the unique_identifier attribute of a GetAttributes response payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload()
|
payload = payloads.GetAttributesResponsePayload()
|
||||||
args = (payload, 'unique_identifier', 0)
|
args = (payload, 'unique_identifier', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -843,7 +843,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the attributes attribute of a GetAttributes response
|
Test that the attributes attribute of a GetAttributes response
|
||||||
payload can be properly set and retrieved.
|
payload can be properly set and retrieved.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload()
|
payload = payloads.GetAttributesResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(list(), payload.attributes)
|
self.assertEqual(list(), payload.attributes)
|
||||||
self.assertEqual(list(), payload._attributes)
|
self.assertEqual(list(), payload._attributes)
|
||||||
|
@ -863,7 +863,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that a TypeError is raised when an invalid list is used to set
|
Test that a TypeError is raised when an invalid list is used to set
|
||||||
the attributes attribute of a GetAttributes response payload.
|
the attributes attribute of a GetAttributes response payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload()
|
payload = payloads.GetAttributesResponsePayload()
|
||||||
args = (payload, 'attributes', 0)
|
args = (payload, 'attributes', 0)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -878,7 +878,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
in the list used to set the attributes attribute of a GetAttributes
|
in the list used to set the attributes attribute of a GetAttributes
|
||||||
response payload.
|
response payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload()
|
payload = payloads.GetAttributesResponsePayload()
|
||||||
args = (
|
args = (
|
||||||
payload,
|
payload,
|
||||||
'attributes',
|
'attributes',
|
||||||
|
@ -897,7 +897,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributes response payload can be read from a data
|
Test that a GetAttributes response payload can be read from a data
|
||||||
stream.
|
stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload()
|
payload = payloads.GetAttributesResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
self.assertEqual(list(), payload._attributes)
|
self.assertEqual(list(), payload._attributes)
|
||||||
|
@ -927,7 +927,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that an InvalidKmipEncoding error gets raised when attempting to
|
Test that an InvalidKmipEncoding error gets raised when attempting to
|
||||||
read a GetAttributes response encoding with no ID data.
|
read a GetAttributes response encoding with no ID data.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload()
|
payload = payloads.GetAttributesResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
self.assertEqual(list(), payload._attributes)
|
self.assertEqual(list(), payload._attributes)
|
||||||
|
@ -945,7 +945,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributes response payload without attribute name
|
Test that a GetAttributes response payload without attribute name
|
||||||
data can be read from a data stream.
|
data can be read from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload()
|
payload = payloads.GetAttributesResponsePayload()
|
||||||
|
|
||||||
self.assertEqual(None, payload._unique_identifier)
|
self.assertEqual(None, payload._unique_identifier)
|
||||||
self.assertEqual(list(), payload._attributes)
|
self.assertEqual(list(), payload._attributes)
|
||||||
|
@ -968,7 +968,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributes response payload can be written to a data
|
Test that a GetAttributes response payload can be written to a data
|
||||||
stream.
|
stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload(
|
payload = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
@ -983,7 +983,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributes request payload with no ID can be written
|
Test that a GetAttributes request payload with no ID can be written
|
||||||
to a data stream.
|
to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload(
|
payload = payloads.GetAttributesResponsePayload(
|
||||||
None,
|
None,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
@ -1002,7 +1002,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that a GetAttributes response payload with no attribute name
|
Test that a GetAttributes response payload with no attribute name
|
||||||
data can be written to a data stream.
|
data can be written to a data stream.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload(
|
payload = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
@ -1016,7 +1016,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that repr can be applied to a GetAttributes response payload.
|
Test that repr can be applied to a GetAttributes response payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload(
|
payload = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
@ -1037,7 +1037,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
Test that str can be applied to a GetAttributes response payload.
|
Test that str can be applied to a GetAttributes response payload.
|
||||||
"""
|
"""
|
||||||
payload = get_attributes.GetAttributesResponsePayload(
|
payload = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
@ -1053,11 +1053,11 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns True when comparing two
|
Test that the equality operator returns True when comparing two
|
||||||
GetAttributes response payloads with the same data.
|
GetAttributes response payloads with the same data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesResponsePayload(
|
b = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
@ -1070,11 +1070,11 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetAttributes response payloads with different data.
|
GetAttributes response payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesResponsePayload(
|
b = payloads.GetAttributesResponsePayload(
|
||||||
'invalid',
|
'invalid',
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
@ -1087,13 +1087,13 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetAttributes response payloads with different data.
|
GetAttributes response payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
reversed_attributes = copy.deepcopy(self.attributes)
|
reversed_attributes = copy.deepcopy(self.attributes)
|
||||||
reversed_attributes.reverse()
|
reversed_attributes.reverse()
|
||||||
b = get_attributes.GetAttributesResponsePayload(
|
b = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
reversed_attributes
|
reversed_attributes
|
||||||
)
|
)
|
||||||
|
@ -1106,11 +1106,11 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetAttributes response payloads with different data.
|
GetAttributes response payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesResponsePayload(
|
b = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
list()
|
list()
|
||||||
)
|
)
|
||||||
|
@ -1123,11 +1123,11 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the equality operator returns False when comparing two
|
Test that the equality operator returns False when comparing two
|
||||||
GetAttributes response payloads with different data.
|
GetAttributes response payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesResponsePayload(
|
b = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
@ -1141,7 +1141,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
GetAttributes response payload to a non-GetAttributes response
|
GetAttributes response payload to a non-GetAttributes response
|
||||||
payload.
|
payload.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
@ -1155,11 +1155,11 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing
|
Test that the inequality operator returns False when comparing
|
||||||
two GetAttributes response payloads with the same internal data.
|
two GetAttributes response payloads with the same internal data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesResponsePayload(
|
b = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
@ -1172,11 +1172,11 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns True when comparing two
|
Test that the inequality operator returns True when comparing two
|
||||||
GetAttributes request payloads with different data.
|
GetAttributes request payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesResponsePayload(
|
b = payloads.GetAttributesResponsePayload(
|
||||||
'invalid',
|
'invalid',
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
@ -1189,13 +1189,13 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing two
|
Test that the inequality operator returns False when comparing two
|
||||||
GetAttributes response payloads with different data.
|
GetAttributes response payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
reversed_attributes = copy.deepcopy(self.attributes)
|
reversed_attributes = copy.deepcopy(self.attributes)
|
||||||
reversed_attributes.reverse()
|
reversed_attributes.reverse()
|
||||||
b = get_attributes.GetAttributesResponsePayload(
|
b = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
reversed_attributes
|
reversed_attributes
|
||||||
)
|
)
|
||||||
|
@ -1208,11 +1208,11 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing two
|
Test that the inequality operator returns False when comparing two
|
||||||
GetAttributes response payloads with different data.
|
GetAttributes response payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesResponsePayload(
|
b = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
list()
|
list()
|
||||||
)
|
)
|
||||||
|
@ -1225,11 +1225,11 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
Test that the inequality operator returns False when comparing two
|
Test that the inequality operator returns False when comparing two
|
||||||
GetAttributes response payloads with different data.
|
GetAttributes response payloads with different data.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
b = get_attributes.GetAttributesResponsePayload(
|
b = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
@ -1243,7 +1243,7 @@ class TestGetAttributesResponsePayload(testtools.TestCase):
|
||||||
GetAttributes response payload to a non-GetAttributes response
|
GetAttributes response payload to a non-GetAttributes response
|
||||||
payload.
|
payload.
|
||||||
"""
|
"""
|
||||||
a = get_attributes.GetAttributesResponsePayload(
|
a = payloads.GetAttributesResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.attributes
|
self.attributes
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,7 +20,7 @@ from kmip.core import utils
|
||||||
from kmip.core import enums
|
from kmip.core import enums
|
||||||
from kmip.core import exceptions
|
from kmip.core import exceptions
|
||||||
|
|
||||||
from kmip.core.messages.payloads import mac
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestMACRequestPayload(TestCase):
|
class TestMACRequestPayload(TestCase):
|
||||||
|
@ -55,14 +55,14 @@ class TestMACRequestPayload(TestCase):
|
||||||
super(TestMACRequestPayload, self).tearDown()
|
super(TestMACRequestPayload, self).tearDown()
|
||||||
|
|
||||||
def test_init_with_none(self):
|
def test_init_with_none(self):
|
||||||
mac.MACRequestPayload()
|
payloads.MACRequestPayload()
|
||||||
|
|
||||||
def test_init_valid(self):
|
def test_init_valid(self):
|
||||||
"""
|
"""
|
||||||
Test that the payload can be properly constructed and the attributes
|
Test that the payload can be properly constructed and the attributes
|
||||||
cab be properly set and retrieved.
|
cab be properly set and retrieved.
|
||||||
"""
|
"""
|
||||||
payload = mac.MACRequestPayload(
|
payload = payloads.MACRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.cryptographic_parameters,
|
self.cryptographic_parameters,
|
||||||
self.data)
|
self.data)
|
||||||
|
@ -77,7 +77,7 @@ class TestMACRequestPayload(TestCase):
|
||||||
'data': None}
|
'data': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "unique identifier must be UniqueIdentifier type",
|
TypeError, "unique identifier must be UniqueIdentifier type",
|
||||||
mac.MACRequestPayload, **kwargs)
|
payloads.MACRequestPayload, **kwargs)
|
||||||
|
|
||||||
def test_init_with_invalid_cryptographic_parameters(self):
|
def test_init_with_invalid_cryptographic_parameters(self):
|
||||||
kwargs = {'unique_identifier': None,
|
kwargs = {'unique_identifier': None,
|
||||||
|
@ -86,7 +86,7 @@ class TestMACRequestPayload(TestCase):
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError,
|
TypeError,
|
||||||
"cryptographic parameters must be CryptographicParameters type",
|
"cryptographic parameters must be CryptographicParameters type",
|
||||||
mac.MACRequestPayload, **kwargs)
|
payloads.MACRequestPayload, **kwargs)
|
||||||
|
|
||||||
def test_init_with_invalid_data(self):
|
def test_init_with_invalid_data(self):
|
||||||
kwargs = {'unique_identifier': None,
|
kwargs = {'unique_identifier': None,
|
||||||
|
@ -94,11 +94,11 @@ class TestMACRequestPayload(TestCase):
|
||||||
'data': 'invalid'}
|
'data': 'invalid'}
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
TypeError, "data must be Data type",
|
TypeError, "data must be Data type",
|
||||||
mac.MACRequestPayload, **kwargs)
|
payloads.MACRequestPayload, **kwargs)
|
||||||
|
|
||||||
def test_read_valid(self):
|
def test_read_valid(self):
|
||||||
stream = self.encoding_full
|
stream = self.encoding_full
|
||||||
payload = mac.MACRequestPayload()
|
payload = payloads.MACRequestPayload()
|
||||||
payload.read(stream)
|
payload.read(stream)
|
||||||
|
|
||||||
self.assertEqual(self.unique_identifier, payload.unique_identifier)
|
self.assertEqual(self.unique_identifier, payload.unique_identifier)
|
||||||
|
@ -111,7 +111,7 @@ class TestMACRequestPayload(TestCase):
|
||||||
Test that an InvalidKmipEncoding error gets raised when attempting to
|
Test that an InvalidKmipEncoding error gets raised when attempting to
|
||||||
read a mac request encoding with no data.
|
read a mac request encoding with no data.
|
||||||
"""
|
"""
|
||||||
payload = mac.MACRequestPayload()
|
payload = payloads.MACRequestPayload()
|
||||||
args = (self.encoding_no_data,)
|
args = (self.encoding_no_data,)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
exceptions.InvalidKmipEncoding,
|
exceptions.InvalidKmipEncoding,
|
||||||
|
@ -124,7 +124,7 @@ class TestMACRequestPayload(TestCase):
|
||||||
expected = self.encoding_full
|
expected = self.encoding_full
|
||||||
|
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = mac.MACRequestPayload(
|
payload = payloads.MACRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.cryptographic_parameters,
|
self.cryptographic_parameters,
|
||||||
self.data)
|
self.data)
|
||||||
|
@ -138,7 +138,7 @@ class TestMACRequestPayload(TestCase):
|
||||||
write a mac request with no data.
|
write a mac request with no data.
|
||||||
"""
|
"""
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = mac.MACRequestPayload(
|
payload = payloads.MACRequestPayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.cryptographic_parameters,
|
self.cryptographic_parameters,
|
||||||
None)
|
None)
|
||||||
|
@ -189,14 +189,14 @@ class TestMACResponsePayload(TestCase):
|
||||||
super(TestMACResponsePayload, self).tearDown()
|
super(TestMACResponsePayload, self).tearDown()
|
||||||
|
|
||||||
def test_init_with_none(self):
|
def test_init_with_none(self):
|
||||||
mac.MACResponsePayload()
|
payloads.MACResponsePayload()
|
||||||
|
|
||||||
def test_init_valid(self):
|
def test_init_valid(self):
|
||||||
"""
|
"""
|
||||||
Test that the payload can be properly constructed and the attributes
|
Test that the payload can be properly constructed and the attributes
|
||||||
can be properly set and retrieved.
|
can be properly set and retrieved.
|
||||||
"""
|
"""
|
||||||
payload = mac.MACResponsePayload(
|
payload = payloads.MACResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.mac_data)
|
self.mac_data)
|
||||||
self.assertEqual(payload.unique_identifier, self.unique_identifier)
|
self.assertEqual(payload.unique_identifier, self.unique_identifier)
|
||||||
|
@ -207,18 +207,18 @@ class TestMACResponsePayload(TestCase):
|
||||||
'mac_data': None}
|
'mac_data': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "unique identifier must be UniqueIdentifier type",
|
TypeError, "unique identifier must be UniqueIdentifier type",
|
||||||
mac.MACResponsePayload, **kwargs)
|
payloads.MACResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_init_with_invalid_mac_data(self):
|
def test_init_with_invalid_mac_data(self):
|
||||||
kwargs = {'unique_identifier': None,
|
kwargs = {'unique_identifier': None,
|
||||||
'mac_data': 'invalid'}
|
'mac_data': 'invalid'}
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
TypeError, "data must be MACData type",
|
TypeError, "data must be MACData type",
|
||||||
mac.MACResponsePayload, **kwargs)
|
payloads.MACResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_read_valid(self):
|
def test_read_valid(self):
|
||||||
stream = self.encoding_full
|
stream = self.encoding_full
|
||||||
payload = mac.MACResponsePayload()
|
payload = payloads.MACResponsePayload()
|
||||||
payload.read(stream)
|
payload.read(stream)
|
||||||
|
|
||||||
self.assertEqual(self.unique_identifier, payload.unique_identifier)
|
self.assertEqual(self.unique_identifier, payload.unique_identifier)
|
||||||
|
@ -229,7 +229,7 @@ class TestMACResponsePayload(TestCase):
|
||||||
Test that an InvalidKmipEncoding error gets raised when attempting to
|
Test that an InvalidKmipEncoding error gets raised when attempting to
|
||||||
read a mac response encoding with no unique identifier.
|
read a mac response encoding with no unique identifier.
|
||||||
"""
|
"""
|
||||||
payload = mac.MACResponsePayload()
|
payload = payloads.MACResponsePayload()
|
||||||
args = (self.encoding_no_unique_identifier,)
|
args = (self.encoding_no_unique_identifier,)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
exceptions.InvalidKmipEncoding,
|
exceptions.InvalidKmipEncoding,
|
||||||
|
@ -243,7 +243,7 @@ class TestMACResponsePayload(TestCase):
|
||||||
Test that an InvalidKmipEncoding error gets raised when attempting to
|
Test that an InvalidKmipEncoding error gets raised when attempting to
|
||||||
read a mac response encoding with no mac data.
|
read a mac response encoding with no mac data.
|
||||||
"""
|
"""
|
||||||
payload = mac.MACResponsePayload()
|
payload = payloads.MACResponsePayload()
|
||||||
args = (self.encoding_no_mac_data,)
|
args = (self.encoding_no_mac_data,)
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
exceptions.InvalidKmipEncoding,
|
exceptions.InvalidKmipEncoding,
|
||||||
|
@ -256,7 +256,7 @@ class TestMACResponsePayload(TestCase):
|
||||||
expected = self.encoding_full
|
expected = self.encoding_full
|
||||||
|
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = mac.MACResponsePayload(
|
payload = payloads.MACResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
self.mac_data)
|
self.mac_data)
|
||||||
payload.write(stream)
|
payload.write(stream)
|
||||||
|
@ -269,7 +269,7 @@ class TestMACResponsePayload(TestCase):
|
||||||
write a mac response with no unique identifier.
|
write a mac response with no unique identifier.
|
||||||
"""
|
"""
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = mac.MACResponsePayload(
|
payload = payloads.MACResponsePayload(
|
||||||
None,
|
None,
|
||||||
self.mac_data)
|
self.mac_data)
|
||||||
args = (stream,)
|
args = (stream,)
|
||||||
|
@ -286,7 +286,7 @@ class TestMACResponsePayload(TestCase):
|
||||||
write a mac response with no mac data.
|
write a mac response with no mac data.
|
||||||
"""
|
"""
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = mac.MACResponsePayload(
|
payload = payloads.MACResponsePayload(
|
||||||
self.unique_identifier,
|
self.unique_identifier,
|
||||||
None)
|
None)
|
||||||
args = (stream,)
|
args = (stream,)
|
||||||
|
|
|
@ -26,7 +26,7 @@ from kmip.core.enums import Operation as OperationEnum
|
||||||
from kmip.core.enums import QueryFunction as QueryFunctionEnum
|
from kmip.core.enums import QueryFunction as QueryFunctionEnum
|
||||||
|
|
||||||
from kmip.core.messages.contents import Operation
|
from kmip.core.messages.contents import Operation
|
||||||
from kmip.core.messages.payloads import query
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
from kmip.core.misc import QueryFunction
|
from kmip.core.misc import QueryFunction
|
||||||
from kmip.core.misc import VendorIdentification
|
from kmip.core.misc import VendorIdentification
|
||||||
|
@ -82,16 +82,16 @@ class TestQueryRequestPayload(TestCase):
|
||||||
Test that a QueryRequestPayload object can be constructed with no
|
Test that a QueryRequestPayload object can be constructed with no
|
||||||
specified value.
|
specified value.
|
||||||
"""
|
"""
|
||||||
query.QueryRequestPayload()
|
payloads.QueryRequestPayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
"""
|
"""
|
||||||
Test that a QueryRequestPayload object can be constructed with valid
|
Test that a QueryRequestPayload object can be constructed with valid
|
||||||
values.
|
values.
|
||||||
"""
|
"""
|
||||||
query.QueryRequestPayload(self.query_functions_a)
|
payloads.QueryRequestPayload(self.query_functions_a)
|
||||||
query.QueryRequestPayload(self.query_functions_b)
|
payloads.QueryRequestPayload(self.query_functions_b)
|
||||||
query.QueryRequestPayload(self.query_functions_c)
|
payloads.QueryRequestPayload(self.query_functions_c)
|
||||||
|
|
||||||
def test_validate_with_invalid_query_functions_list(self):
|
def test_validate_with_invalid_query_functions_list(self):
|
||||||
"""
|
"""
|
||||||
|
@ -101,7 +101,7 @@ class TestQueryRequestPayload(TestCase):
|
||||||
kwargs = {'query_functions': 'invalid'}
|
kwargs = {'query_functions': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid query functions list",
|
TypeError, "invalid query functions list",
|
||||||
query.QueryRequestPayload, **kwargs)
|
payloads.QueryRequestPayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_query_functions_item(self):
|
def test_validate_with_invalid_query_functions_item(self):
|
||||||
"""
|
"""
|
||||||
|
@ -111,10 +111,10 @@ class TestQueryRequestPayload(TestCase):
|
||||||
kwargs = {'query_functions': ['invalid']}
|
kwargs = {'query_functions': ['invalid']}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid query function",
|
TypeError, "invalid query function",
|
||||||
query.QueryRequestPayload, **kwargs)
|
payloads.QueryRequestPayload, **kwargs)
|
||||||
|
|
||||||
def _test_read(self, stream, query_functions):
|
def _test_read(self, stream, query_functions):
|
||||||
payload = query.QueryRequestPayload()
|
payload = payloads.QueryRequestPayload()
|
||||||
payload.read(stream)
|
payload.read(stream)
|
||||||
expected = len(query_functions)
|
expected = len(query_functions)
|
||||||
observed = len(payload.query_functions)
|
observed = len(payload.query_functions)
|
||||||
|
@ -155,7 +155,7 @@ class TestQueryRequestPayload(TestCase):
|
||||||
|
|
||||||
def _test_write(self, encoding, query_functions):
|
def _test_write(self, encoding, query_functions):
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = query.QueryRequestPayload(query_functions)
|
payload = payloads.QueryRequestPayload(query_functions)
|
||||||
payload.write(stream)
|
payload.write(stream)
|
||||||
|
|
||||||
length_expected = len(encoding)
|
length_expected = len(encoding)
|
||||||
|
@ -307,14 +307,14 @@ class TestQueryResponsePayload(TestCase):
|
||||||
Test that a QueryResponsePayload object can be constructed with no
|
Test that a QueryResponsePayload object can be constructed with no
|
||||||
specified value.
|
specified value.
|
||||||
"""
|
"""
|
||||||
query.QueryResponsePayload()
|
payloads.QueryResponsePayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
"""
|
"""
|
||||||
Test that a QueryResponsePayload object can be constructed with valid
|
Test that a QueryResponsePayload object can be constructed with valid
|
||||||
values.
|
values.
|
||||||
"""
|
"""
|
||||||
query.QueryResponsePayload(
|
payloads.QueryResponsePayload(
|
||||||
operations=self.operations,
|
operations=self.operations,
|
||||||
object_types=self.object_types,
|
object_types=self.object_types,
|
||||||
vendor_identification=self.vendor_identification,
|
vendor_identification=self.vendor_identification,
|
||||||
|
@ -330,7 +330,7 @@ class TestQueryResponsePayload(TestCase):
|
||||||
kwargs = {'operations': 'invalid'}
|
kwargs = {'operations': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid operations list",
|
TypeError, "invalid operations list",
|
||||||
query.QueryResponsePayload, **kwargs)
|
payloads.QueryResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_operations_item(self):
|
def test_validate_with_invalid_operations_item(self):
|
||||||
"""
|
"""
|
||||||
|
@ -340,7 +340,7 @@ class TestQueryResponsePayload(TestCase):
|
||||||
kwargs = {'operations': ['invalid']}
|
kwargs = {'operations': ['invalid']}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid operation",
|
TypeError, "invalid operation",
|
||||||
query.QueryResponsePayload, **kwargs)
|
payloads.QueryResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_object_types_list(self):
|
def test_validate_with_invalid_object_types_list(self):
|
||||||
"""
|
"""
|
||||||
|
@ -350,7 +350,7 @@ class TestQueryResponsePayload(TestCase):
|
||||||
kwargs = {'object_types': 'invalid'}
|
kwargs = {'object_types': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid object types list",
|
TypeError, "invalid object types list",
|
||||||
query.QueryResponsePayload, **kwargs)
|
payloads.QueryResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_object_types_item(self):
|
def test_validate_with_invalid_object_types_item(self):
|
||||||
"""
|
"""
|
||||||
|
@ -360,7 +360,7 @@ class TestQueryResponsePayload(TestCase):
|
||||||
kwargs = {'object_types': ['invalid']}
|
kwargs = {'object_types': ['invalid']}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid object type",
|
TypeError, "invalid object type",
|
||||||
query.QueryResponsePayload, **kwargs)
|
payloads.QueryResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_vendor_identification(self):
|
def test_validate_with_invalid_vendor_identification(self):
|
||||||
"""
|
"""
|
||||||
|
@ -371,7 +371,7 @@ class TestQueryResponsePayload(TestCase):
|
||||||
kwargs = {'vendor_identification': 'invalid'}
|
kwargs = {'vendor_identification': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid vendor identification",
|
TypeError, "invalid vendor identification",
|
||||||
query.QueryResponsePayload, **kwargs)
|
payloads.QueryResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_server_information(self):
|
def test_validate_with_invalid_server_information(self):
|
||||||
"""
|
"""
|
||||||
|
@ -382,7 +382,7 @@ class TestQueryResponsePayload(TestCase):
|
||||||
kwargs = {'server_information': 'invalid'}
|
kwargs = {'server_information': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid server information",
|
TypeError, "invalid server information",
|
||||||
query.QueryResponsePayload, **kwargs)
|
payloads.QueryResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_application_namespaces_list(self):
|
def test_validate_with_invalid_application_namespaces_list(self):
|
||||||
"""
|
"""
|
||||||
|
@ -393,7 +393,7 @@ class TestQueryResponsePayload(TestCase):
|
||||||
kwargs = {'application_namespaces': 'invalid'}
|
kwargs = {'application_namespaces': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid application namespaces list",
|
TypeError, "invalid application namespaces list",
|
||||||
query.QueryResponsePayload, **kwargs)
|
payloads.QueryResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_application_namespaces_item(self):
|
def test_validate_with_invalid_application_namespaces_item(self):
|
||||||
"""
|
"""
|
||||||
|
@ -404,7 +404,7 @@ class TestQueryResponsePayload(TestCase):
|
||||||
kwargs = {'application_namespaces': ['invalid']}
|
kwargs = {'application_namespaces': ['invalid']}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid application namespace",
|
TypeError, "invalid application namespace",
|
||||||
query.QueryResponsePayload, **kwargs)
|
payloads.QueryResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_extension_information_list(self):
|
def test_validate_with_invalid_extension_information_list(self):
|
||||||
"""
|
"""
|
||||||
|
@ -415,7 +415,7 @@ class TestQueryResponsePayload(TestCase):
|
||||||
kwargs = {'extension_information': 'invalid'}
|
kwargs = {'extension_information': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid extension information list",
|
TypeError, "invalid extension information list",
|
||||||
query.QueryResponsePayload, **kwargs)
|
payloads.QueryResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_extension_information_item(self):
|
def test_validate_with_invalid_extension_information_item(self):
|
||||||
"""
|
"""
|
||||||
|
@ -426,12 +426,12 @@ class TestQueryResponsePayload(TestCase):
|
||||||
kwargs = {'extension_information': ['invalid']}
|
kwargs = {'extension_information': ['invalid']}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid extension information",
|
TypeError, "invalid extension information",
|
||||||
query.QueryResponsePayload, **kwargs)
|
payloads.QueryResponsePayload, **kwargs)
|
||||||
|
|
||||||
def _test_read(self, stream, operations, object_types,
|
def _test_read(self, stream, operations, object_types,
|
||||||
vendor_identification, server_information,
|
vendor_identification, server_information,
|
||||||
application_namespaces, extension_information):
|
application_namespaces, extension_information):
|
||||||
payload = query.QueryResponsePayload()
|
payload = payloads.QueryResponsePayload()
|
||||||
payload.read(stream)
|
payload.read(stream)
|
||||||
|
|
||||||
# Test decoding of all operations.
|
# Test decoding of all operations.
|
||||||
|
@ -541,7 +541,7 @@ class TestQueryResponsePayload(TestCase):
|
||||||
vendor_identification, server_information,
|
vendor_identification, server_information,
|
||||||
application_namespaces, extension_information):
|
application_namespaces, extension_information):
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = query.QueryResponsePayload(
|
payload = payloads.QueryResponsePayload(
|
||||||
operations, object_types, vendor_identification,
|
operations, object_types, vendor_identification,
|
||||||
server_information, application_namespaces, extension_information)
|
server_information, application_namespaces, extension_information)
|
||||||
payload.write(stream)
|
payload.write(stream)
|
||||||
|
|
|
@ -20,7 +20,7 @@ from kmip.core import misc
|
||||||
from kmip.core import objects
|
from kmip.core import objects
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
|
|
||||||
from kmip.core.messages.payloads import rekey_key_pair
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestRekeyKeyPairRequestPayload(TestCase):
|
class TestRekeyKeyPairRequestPayload(TestCase):
|
||||||
|
@ -53,10 +53,10 @@ class TestRekeyKeyPairRequestPayload(TestCase):
|
||||||
super(TestRekeyKeyPairRequestPayload, self).tearDown()
|
super(TestRekeyKeyPairRequestPayload, self).tearDown()
|
||||||
|
|
||||||
def test_init_with_none(self):
|
def test_init_with_none(self):
|
||||||
rekey_key_pair.RekeyKeyPairRequestPayload()
|
payloads.RekeyKeyPairRequestPayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
rekey_key_pair.RekeyKeyPairRequestPayload(
|
payloads.RekeyKeyPairRequestPayload(
|
||||||
self.private_key_uuid, self.offset, self.common_template_attribute,
|
self.private_key_uuid, self.offset, self.common_template_attribute,
|
||||||
self.private_key_template_attribute,
|
self.private_key_template_attribute,
|
||||||
self.public_key_template_attribute)
|
self.public_key_template_attribute)
|
||||||
|
@ -68,7 +68,7 @@ class TestRekeyKeyPairRequestPayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid private key unique identifier",
|
TypeError, "invalid private key unique identifier",
|
||||||
rekey_key_pair.RekeyKeyPairRequestPayload, **kwargs)
|
payloads.RekeyKeyPairRequestPayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_offset(self):
|
def test_validate_with_invalid_offset(self):
|
||||||
kwargs = {'private_key_uuid': None, 'offset': 'invalid',
|
kwargs = {'private_key_uuid': None, 'offset': 'invalid',
|
||||||
|
@ -77,7 +77,7 @@ class TestRekeyKeyPairRequestPayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid offset",
|
TypeError, "invalid offset",
|
||||||
rekey_key_pair.RekeyKeyPairRequestPayload, **kwargs)
|
payloads.RekeyKeyPairRequestPayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_common_template_attribute(self):
|
def test_validate_with_invalid_common_template_attribute(self):
|
||||||
kwargs = {'private_key_uuid': None, 'offset': None,
|
kwargs = {'private_key_uuid': None, 'offset': None,
|
||||||
|
@ -86,7 +86,7 @@ class TestRekeyKeyPairRequestPayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid common template attribute",
|
TypeError, "invalid common template attribute",
|
||||||
rekey_key_pair.RekeyKeyPairRequestPayload, **kwargs)
|
payloads.RekeyKeyPairRequestPayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_private_key_template_attribute(self):
|
def test_validate_with_invalid_private_key_template_attribute(self):
|
||||||
kwargs = {'private_key_uuid': None, 'offset': None,
|
kwargs = {'private_key_uuid': None, 'offset': None,
|
||||||
|
@ -95,7 +95,7 @@ class TestRekeyKeyPairRequestPayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid private key template attribute",
|
TypeError, "invalid private key template attribute",
|
||||||
rekey_key_pair.RekeyKeyPairRequestPayload, **kwargs)
|
payloads.RekeyKeyPairRequestPayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_public_key_template_attribute(self):
|
def test_validate_with_invalid_public_key_template_attribute(self):
|
||||||
kwargs = {'private_key_uuid': None, 'offset': None,
|
kwargs = {'private_key_uuid': None, 'offset': None,
|
||||||
|
@ -104,7 +104,7 @@ class TestRekeyKeyPairRequestPayload(TestCase):
|
||||||
'public_key_template_attribute': 'invalid'}
|
'public_key_template_attribute': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid public key template attribute",
|
TypeError, "invalid public key template attribute",
|
||||||
rekey_key_pair.RekeyKeyPairRequestPayload, **kwargs)
|
payloads.RekeyKeyPairRequestPayload, **kwargs)
|
||||||
|
|
||||||
def _test_read(self, stream, payload, private_key_uuid, offset,
|
def _test_read(self, stream, payload, private_key_uuid, offset,
|
||||||
common_template_attribute, private_key_template_attribute,
|
common_template_attribute, private_key_template_attribute,
|
||||||
|
@ -142,13 +142,13 @@ class TestRekeyKeyPairRequestPayload(TestCase):
|
||||||
|
|
||||||
def test_read_with_none(self):
|
def test_read_with_none(self):
|
||||||
stream = self.encoding_empty
|
stream = self.encoding_empty
|
||||||
payload = rekey_key_pair.RekeyKeyPairRequestPayload()
|
payload = payloads.RekeyKeyPairRequestPayload()
|
||||||
|
|
||||||
self._test_read(stream, payload, None, None, None, None, None)
|
self._test_read(stream, payload, None, None, None, None, None)
|
||||||
|
|
||||||
def test_read_with_args(self):
|
def test_read_with_args(self):
|
||||||
stream = self.encoding_full
|
stream = self.encoding_full
|
||||||
payload = rekey_key_pair.RekeyKeyPairRequestPayload()
|
payload = payloads.RekeyKeyPairRequestPayload()
|
||||||
|
|
||||||
self._test_read(stream, payload, self.private_key_uuid, self.offset,
|
self._test_read(stream, payload, self.private_key_uuid, self.offset,
|
||||||
self.common_template_attribute,
|
self.common_template_attribute,
|
||||||
|
@ -173,13 +173,13 @@ class TestRekeyKeyPairRequestPayload(TestCase):
|
||||||
|
|
||||||
def test_write_with_none(self):
|
def test_write_with_none(self):
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = rekey_key_pair.RekeyKeyPairRequestPayload()
|
payload = payloads.RekeyKeyPairRequestPayload()
|
||||||
|
|
||||||
self._test_write(stream, payload, self.encoding_empty)
|
self._test_write(stream, payload, self.encoding_empty)
|
||||||
|
|
||||||
def test_write_with_args(self):
|
def test_write_with_args(self):
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = rekey_key_pair.RekeyKeyPairRequestPayload(
|
payload = payloads.RekeyKeyPairRequestPayload(
|
||||||
self.private_key_uuid, self.offset, self.common_template_attribute,
|
self.private_key_uuid, self.offset, self.common_template_attribute,
|
||||||
self.private_key_template_attribute,
|
self.private_key_template_attribute,
|
||||||
self.public_key_template_attribute)
|
self.public_key_template_attribute)
|
||||||
|
@ -222,10 +222,10 @@ class TestRekeyKeyPairResponsePayload(TestCase):
|
||||||
super(TestRekeyKeyPairResponsePayload, self).tearDown()
|
super(TestRekeyKeyPairResponsePayload, self).tearDown()
|
||||||
|
|
||||||
def test_init_with_none(self):
|
def test_init_with_none(self):
|
||||||
rekey_key_pair.RekeyKeyPairResponsePayload()
|
payloads.RekeyKeyPairResponsePayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
rekey_key_pair.RekeyKeyPairResponsePayload(
|
payloads.RekeyKeyPairResponsePayload(
|
||||||
self.private_key_uuid, self.public_key_uuid,
|
self.private_key_uuid, self.public_key_uuid,
|
||||||
self.private_key_template_attribute,
|
self.private_key_template_attribute,
|
||||||
self.public_key_template_attribute)
|
self.public_key_template_attribute)
|
||||||
|
@ -237,7 +237,7 @@ class TestRekeyKeyPairResponsePayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid private key unique identifier",
|
TypeError, "invalid private key unique identifier",
|
||||||
rekey_key_pair.RekeyKeyPairResponsePayload, **kwargs)
|
payloads.RekeyKeyPairResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_public_key_unique_identifier(self):
|
def test_validate_with_invalid_public_key_unique_identifier(self):
|
||||||
kwargs = {'private_key_uuid': None,
|
kwargs = {'private_key_uuid': None,
|
||||||
|
@ -246,7 +246,7 @@ class TestRekeyKeyPairResponsePayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid public key unique identifier",
|
TypeError, "invalid public key unique identifier",
|
||||||
rekey_key_pair.RekeyKeyPairResponsePayload, **kwargs)
|
payloads.RekeyKeyPairResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_private_key_template_attribute(self):
|
def test_validate_with_invalid_private_key_template_attribute(self):
|
||||||
kwargs = {'private_key_uuid': None,
|
kwargs = {'private_key_uuid': None,
|
||||||
|
@ -255,7 +255,7 @@ class TestRekeyKeyPairResponsePayload(TestCase):
|
||||||
'public_key_template_attribute': None}
|
'public_key_template_attribute': None}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid private key template attribute",
|
TypeError, "invalid private key template attribute",
|
||||||
rekey_key_pair.RekeyKeyPairResponsePayload, **kwargs)
|
payloads.RekeyKeyPairResponsePayload, **kwargs)
|
||||||
|
|
||||||
def test_validate_with_invalid_public_key_template_attribute(self):
|
def test_validate_with_invalid_public_key_template_attribute(self):
|
||||||
kwargs = {'private_key_uuid': None,
|
kwargs = {'private_key_uuid': None,
|
||||||
|
@ -264,7 +264,7 @@ class TestRekeyKeyPairResponsePayload(TestCase):
|
||||||
'public_key_template_attribute': 'invalid'}
|
'public_key_template_attribute': 'invalid'}
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid public key template attribute",
|
TypeError, "invalid public key template attribute",
|
||||||
rekey_key_pair.RekeyKeyPairResponsePayload, **kwargs)
|
payloads.RekeyKeyPairResponsePayload, **kwargs)
|
||||||
|
|
||||||
def _test_read(self, stream, payload, private_key_uuid, public_key_uuid,
|
def _test_read(self, stream, payload, private_key_uuid, public_key_uuid,
|
||||||
private_key_template_attribute,
|
private_key_template_attribute,
|
||||||
|
@ -297,14 +297,14 @@ class TestRekeyKeyPairResponsePayload(TestCase):
|
||||||
|
|
||||||
def test_read_with_none(self):
|
def test_read_with_none(self):
|
||||||
stream = self.encoding_empty
|
stream = self.encoding_empty
|
||||||
payload = rekey_key_pair.RekeyKeyPairResponsePayload()
|
payload = payloads.RekeyKeyPairResponsePayload()
|
||||||
|
|
||||||
self._test_read(stream, payload, self.empty_private_key_uuid,
|
self._test_read(stream, payload, self.empty_private_key_uuid,
|
||||||
self.empty_public_key_uuid, None, None)
|
self.empty_public_key_uuid, None, None)
|
||||||
|
|
||||||
def test_read_with_args(self):
|
def test_read_with_args(self):
|
||||||
stream = self.encoding_full
|
stream = self.encoding_full
|
||||||
payload = rekey_key_pair.RekeyKeyPairResponsePayload(
|
payload = payloads.RekeyKeyPairResponsePayload(
|
||||||
self.private_key_uuid, self.public_key_uuid,
|
self.private_key_uuid, self.public_key_uuid,
|
||||||
self.private_key_template_attribute,
|
self.private_key_template_attribute,
|
||||||
self.public_key_template_attribute)
|
self.public_key_template_attribute)
|
||||||
|
@ -332,13 +332,13 @@ class TestRekeyKeyPairResponsePayload(TestCase):
|
||||||
|
|
||||||
def test_write_with_none(self):
|
def test_write_with_none(self):
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = rekey_key_pair.RekeyKeyPairResponsePayload()
|
payload = payloads.RekeyKeyPairResponsePayload()
|
||||||
|
|
||||||
self._test_write(stream, payload, self.encoding_empty)
|
self._test_write(stream, payload, self.encoding_empty)
|
||||||
|
|
||||||
def test_write_with_args(self):
|
def test_write_with_args(self):
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = rekey_key_pair.RekeyKeyPairResponsePayload(
|
payload = payloads.RekeyKeyPairResponsePayload(
|
||||||
self.private_key_uuid, self.public_key_uuid,
|
self.private_key_uuid, self.public_key_uuid,
|
||||||
self.private_key_template_attribute,
|
self.private_key_template_attribute,
|
||||||
self.public_key_template_attribute)
|
self.public_key_template_attribute)
|
||||||
|
|
|
@ -21,7 +21,7 @@ from kmip.core import objects
|
||||||
from kmip.core import primitives
|
from kmip.core import primitives
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
|
|
||||||
from kmip.core.messages.payloads import revoke
|
from kmip.core.messages import payloads
|
||||||
|
|
||||||
|
|
||||||
class TestRevokeRequestPayload(TestCase):
|
class TestRevokeRequestPayload(TestCase):
|
||||||
|
@ -55,14 +55,14 @@ class TestRevokeRequestPayload(TestCase):
|
||||||
Test that a RevokeRequestPayload object can be constructed with no
|
Test that a RevokeRequestPayload object can be constructed with no
|
||||||
specified value.
|
specified value.
|
||||||
"""
|
"""
|
||||||
revoke.RevokeRequestPayload()
|
payloads.RevokeRequestPayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
"""
|
"""
|
||||||
Test that a RevokeRequestPayload object can be constructed with valid
|
Test that a RevokeRequestPayload object can be constructed with valid
|
||||||
values.
|
values.
|
||||||
"""
|
"""
|
||||||
revoke.RevokeRequestPayload(unique_identifier=self.uuid)
|
payloads.RevokeRequestPayload(unique_identifier=self.uuid)
|
||||||
|
|
||||||
def test_validate_with_bad_uuid_type(self):
|
def test_validate_with_bad_uuid_type(self):
|
||||||
"""
|
"""
|
||||||
|
@ -71,7 +71,7 @@ class TestRevokeRequestPayload(TestCase):
|
||||||
"""
|
"""
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid unique identifier",
|
TypeError, "invalid unique identifier",
|
||||||
revoke.RevokeRequestPayload, "not-a-uuid")
|
payloads.RevokeRequestPayload, "not-a-uuid")
|
||||||
|
|
||||||
def test_validate_with_bad_date_type(self):
|
def test_validate_with_bad_date_type(self):
|
||||||
"""
|
"""
|
||||||
|
@ -81,7 +81,7 @@ class TestRevokeRequestPayload(TestCase):
|
||||||
reason = objects.RevocationReason()
|
reason = objects.RevocationReason()
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid compromise time",
|
TypeError, "invalid compromise time",
|
||||||
revoke.RevokeRequestPayload, self.uuid, reason, "not-a-date")
|
payloads.RevokeRequestPayload, self.uuid, reason, "not-a-date")
|
||||||
|
|
||||||
def test_validate_with_bad_reason_type(self):
|
def test_validate_with_bad_reason_type(self):
|
||||||
"""
|
"""
|
||||||
|
@ -90,14 +90,14 @@ class TestRevokeRequestPayload(TestCase):
|
||||||
"""
|
"""
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid revocation reason",
|
TypeError, "invalid revocation reason",
|
||||||
revoke.RevokeRequestPayload, self.uuid, "not-a-reason")
|
payloads.RevokeRequestPayload, self.uuid, "not-a-reason")
|
||||||
|
|
||||||
def test_read_with_known_uuid(self):
|
def test_read_with_known_uuid(self):
|
||||||
"""
|
"""
|
||||||
Test that a RevokeRequestPayload object with known UUID can be read
|
Test that a RevokeRequestPayload object with known UUID can be read
|
||||||
from a data stream.
|
from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = revoke.RevokeRequestPayload()
|
payload = payloads.RevokeRequestPayload()
|
||||||
payload.read(self.encoding_a)
|
payload.read(self.encoding_a)
|
||||||
expected = '668eff89-3010-4258-bc0e-8c402309c746'
|
expected = '668eff89-3010-4258-bc0e-8c402309c746'
|
||||||
observed = payload.unique_identifier.value
|
observed = payload.unique_identifier.value
|
||||||
|
@ -118,7 +118,7 @@ class TestRevokeRequestPayload(TestCase):
|
||||||
tag=enums.Tags.COMPROMISE_OCCURRENCE_DATE, value=6)
|
tag=enums.Tags.COMPROMISE_OCCURRENCE_DATE, value=6)
|
||||||
|
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = revoke.RevokeRequestPayload(
|
payload = payloads.RevokeRequestPayload(
|
||||||
unique_identifier=self.uuid,
|
unique_identifier=self.uuid,
|
||||||
revocation_reason=reason,
|
revocation_reason=reason,
|
||||||
compromise_occurrence_date=date)
|
compromise_occurrence_date=date)
|
||||||
|
@ -165,14 +165,14 @@ class TestRevokeResponsePayload(TestCase):
|
||||||
Test that a RevokeResponsePayload object can be constructed with no
|
Test that a RevokeResponsePayload object can be constructed with no
|
||||||
specified value.
|
specified value.
|
||||||
"""
|
"""
|
||||||
revoke.RevokeResponsePayload()
|
payloads.RevokeResponsePayload()
|
||||||
|
|
||||||
def test_init_with_args(self):
|
def test_init_with_args(self):
|
||||||
"""
|
"""
|
||||||
Test that a RevokeResponsePayload object can be constructed with
|
Test that a RevokeResponsePayload object can be constructed with
|
||||||
valid values.
|
valid values.
|
||||||
"""
|
"""
|
||||||
revoke.RevokeResponsePayload(unique_identifier=self.uuid)
|
payloads.RevokeResponsePayload(unique_identifier=self.uuid)
|
||||||
|
|
||||||
def test_validate_with_invalid_uuid(self):
|
def test_validate_with_invalid_uuid(self):
|
||||||
"""
|
"""
|
||||||
|
@ -181,14 +181,14 @@ class TestRevokeResponsePayload(TestCase):
|
||||||
"""
|
"""
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegexp(
|
||||||
TypeError, "invalid unique identifier",
|
TypeError, "invalid unique identifier",
|
||||||
revoke.RevokeResponsePayload, "not-a-uuid")
|
payloads.RevokeResponsePayload, "not-a-uuid")
|
||||||
|
|
||||||
def test_read_with_known_uuid(self):
|
def test_read_with_known_uuid(self):
|
||||||
"""
|
"""
|
||||||
Test that a RevokeResponsePayload object with known UUID can be read
|
Test that a RevokeResponsePayload object with known UUID can be read
|
||||||
from a data stream.
|
from a data stream.
|
||||||
"""
|
"""
|
||||||
payload = revoke.RevokeResponsePayload()
|
payload = payloads.RevokeResponsePayload()
|
||||||
payload.read(self.encoding_a)
|
payload.read(self.encoding_a)
|
||||||
expected = '668eff89-3010-4258-bc0e-8c402309c746'
|
expected = '668eff89-3010-4258-bc0e-8c402309c746'
|
||||||
observed = payload.unique_identifier.value
|
observed = payload.unique_identifier.value
|
||||||
|
@ -204,7 +204,7 @@ class TestRevokeResponsePayload(TestCase):
|
||||||
written to a data stream.
|
written to a data stream.
|
||||||
"""
|
"""
|
||||||
stream = utils.BytearrayStream()
|
stream = utils.BytearrayStream()
|
||||||
payload = revoke.RevokeResponsePayload(self.uuid)
|
payload = payloads.RevokeResponsePayload(self.uuid)
|
||||||
payload.write(stream)
|
payload.write(stream)
|
||||||
|
|
||||||
length_expected = len(self.encoding_a)
|
length_expected = len(self.encoding_a)
|
||||||
|
|
|
@ -43,12 +43,7 @@ from kmip.core import objects
|
||||||
|
|
||||||
from kmip.core.messages import contents
|
from kmip.core.messages import contents
|
||||||
from kmip.core.messages import messages
|
from kmip.core.messages import messages
|
||||||
from kmip.core.messages.payloads import create
|
from kmip.core.messages import payloads
|
||||||
from kmip.core.messages.payloads import get
|
|
||||||
from kmip.core.messages.payloads import register
|
|
||||||
from kmip.core.messages.payloads import locate
|
|
||||||
from kmip.core.messages.payloads import destroy
|
|
||||||
from kmip.core.messages.payloads import mac
|
|
||||||
|
|
||||||
from kmip.core.misc import KeyFormatType
|
from kmip.core.misc import KeyFormatType
|
||||||
from kmip.core.primitives import TextString
|
from kmip.core.primitives import TextString
|
||||||
|
@ -247,8 +242,8 @@ class TestRequestMessage(TestCase):
|
||||||
request_payload = batch_item.request_payload
|
request_payload = batch_item.request_payload
|
||||||
msg = "Bad request payload type: expected {0}, received {1}"
|
msg = "Bad request payload type: expected {0}, received {1}"
|
||||||
self.assertIsInstance(request_payload,
|
self.assertIsInstance(request_payload,
|
||||||
create.CreateRequestPayload,
|
payloads.CreateRequestPayload,
|
||||||
msg.format(create.CreateRequestPayload,
|
msg.format(payloads.CreateRequestPayload,
|
||||||
type(request_payload)))
|
type(request_payload)))
|
||||||
|
|
||||||
object_type = request_payload.object_type
|
object_type = request_payload.object_type
|
||||||
|
@ -384,8 +379,10 @@ class TestRequestMessage(TestCase):
|
||||||
|
|
||||||
temp_attr = objects.TemplateAttribute(attributes=[attr_a, attr_b,
|
temp_attr = objects.TemplateAttribute(attributes=[attr_a, attr_b,
|
||||||
attr_c])
|
attr_c])
|
||||||
req_pl = create.CreateRequestPayload(object_type=object_type,
|
req_pl = payloads.CreateRequestPayload(
|
||||||
template_attribute=temp_attr)
|
object_type=object_type,
|
||||||
|
template_attribute=temp_attr
|
||||||
|
)
|
||||||
batch_item = messages.RequestBatchItem(operation=operation,
|
batch_item = messages.RequestBatchItem(operation=operation,
|
||||||
request_payload=req_pl)
|
request_payload=req_pl)
|
||||||
req_message = messages.RequestMessage(request_header=request_header,
|
req_message = messages.RequestMessage(request_header=request_header,
|
||||||
|
@ -476,8 +473,8 @@ class TestRequestMessage(TestCase):
|
||||||
request_payload = batch_item.request_payload
|
request_payload = batch_item.request_payload
|
||||||
msg = "Bad request payload type: expected {0}, received {1}"
|
msg = "Bad request payload type: expected {0}, received {1}"
|
||||||
self.assertIsInstance(request_payload,
|
self.assertIsInstance(request_payload,
|
||||||
get.GetRequestPayload,
|
payloads.GetRequestPayload,
|
||||||
msg.format(get.GetRequestPayload,
|
msg.format(payloads.GetRequestPayload,
|
||||||
type(request_payload)))
|
type(request_payload)))
|
||||||
|
|
||||||
# unique_identifier = request_payload.unique_identifier
|
# unique_identifier = request_payload.unique_identifier
|
||||||
|
@ -501,7 +498,7 @@ class TestRequestMessage(TestCase):
|
||||||
operation = contents.Operation(enums.Operation.GET)
|
operation = contents.Operation(enums.Operation.GET)
|
||||||
|
|
||||||
# uuid = attr.UniqueIdentifier('49a1ca88-6bea-4fb2-b450-7e58802c3038')
|
# uuid = attr.UniqueIdentifier('49a1ca88-6bea-4fb2-b450-7e58802c3038')
|
||||||
request_payload = get.GetRequestPayload(
|
request_payload = payloads.GetRequestPayload(
|
||||||
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
unique_identifier='49a1ca88-6bea-4fb2-b450-7e58802c3038'
|
||||||
)
|
)
|
||||||
batch_item = messages.RequestBatchItem(operation=operation,
|
batch_item = messages.RequestBatchItem(operation=operation,
|
||||||
|
@ -594,7 +591,7 @@ class TestRequestMessage(TestCase):
|
||||||
|
|
||||||
request_payload = batch_item.request_payload
|
request_payload = batch_item.request_payload
|
||||||
msg = "Bad request payload type: expected {0}, received {1}"
|
msg = "Bad request payload type: expected {0}, received {1}"
|
||||||
exp_type = destroy.DestroyRequestPayload
|
exp_type = payloads.DestroyRequestPayload
|
||||||
rcv_type = type(request_payload)
|
rcv_type = type(request_payload)
|
||||||
self.assertIsInstance(request_payload, exp_type,
|
self.assertIsInstance(request_payload, exp_type,
|
||||||
msg.format(exp_type, rcv_type))
|
msg.format(exp_type, rcv_type))
|
||||||
|
@ -620,7 +617,9 @@ class TestRequestMessage(TestCase):
|
||||||
operation = contents.Operation(enums.Operation.DESTROY)
|
operation = contents.Operation(enums.Operation.DESTROY)
|
||||||
|
|
||||||
uuid = attr.UniqueIdentifier('fb4b5b9c-6188-4c63-8142-fe9c328129fc')
|
uuid = attr.UniqueIdentifier('fb4b5b9c-6188-4c63-8142-fe9c328129fc')
|
||||||
request_payload = destroy.DestroyRequestPayload(unique_identifier=uuid)
|
request_payload = payloads.DestroyRequestPayload(
|
||||||
|
unique_identifier=uuid
|
||||||
|
)
|
||||||
batch_item = messages.RequestBatchItem(operation=operation,
|
batch_item = messages.RequestBatchItem(operation=operation,
|
||||||
request_payload=request_payload)
|
request_payload=request_payload)
|
||||||
request_message = messages.RequestMessage(request_header=req_header,
|
request_message = messages.RequestMessage(request_header=req_header,
|
||||||
|
@ -711,7 +710,7 @@ class TestRequestMessage(TestCase):
|
||||||
|
|
||||||
request_payload = batch_item.request_payload
|
request_payload = batch_item.request_payload
|
||||||
msg = "Bad request payload type: expected {0}, received {1}"
|
msg = "Bad request payload type: expected {0}, received {1}"
|
||||||
exp_type = register.RegisterRequestPayload
|
exp_type = payloads.RegisterRequestPayload
|
||||||
rcv_type = type(request_payload)
|
rcv_type = type(request_payload)
|
||||||
self.assertIsInstance(request_payload, exp_type,
|
self.assertIsInstance(request_payload, exp_type,
|
||||||
msg.format(exp_type, rcv_type))
|
msg.format(exp_type, rcv_type))
|
||||||
|
@ -817,7 +816,7 @@ class TestRequestMessage(TestCase):
|
||||||
|
|
||||||
template = Template(attributes=attributes)
|
template = Template(attributes=attributes)
|
||||||
|
|
||||||
request_payload = register.RegisterRequestPayload(
|
request_payload = payloads.RegisterRequestPayload(
|
||||||
object_type=object_type,
|
object_type=object_type,
|
||||||
template_attribute=tmpl_attr,
|
template_attribute=tmpl_attr,
|
||||||
secret=template)
|
secret=template)
|
||||||
|
@ -910,7 +909,7 @@ class TestRequestMessage(TestCase):
|
||||||
|
|
||||||
request_payload = batch_item.request_payload
|
request_payload = batch_item.request_payload
|
||||||
msg = "Bad request payload type: expected {0}, received {1}"
|
msg = "Bad request payload type: expected {0}, received {1}"
|
||||||
exp_type = locate.LocateRequestPayload
|
exp_type = payloads.LocateRequestPayload
|
||||||
rcv_type = type(request_payload)
|
rcv_type = type(request_payload)
|
||||||
self.assertIsInstance(request_payload, exp_type,
|
self.assertIsInstance(request_payload, exp_type,
|
||||||
msg.format(exp_type, rcv_type))
|
msg.format(exp_type, rcv_type))
|
||||||
|
@ -1056,8 +1055,8 @@ class TestRequestMessage(TestCase):
|
||||||
request_payload = batch_item.request_payload
|
request_payload = batch_item.request_payload
|
||||||
msg = "Bad request payload type: expected {0}, received {1}"
|
msg = "Bad request payload type: expected {0}, received {1}"
|
||||||
self.assertIsInstance(request_payload,
|
self.assertIsInstance(request_payload,
|
||||||
mac.MACRequestPayload,
|
payloads.MACRequestPayload,
|
||||||
msg.format(mac.MACRequestPayload,
|
msg.format(payloads.MACRequestPayload,
|
||||||
type(request_payload)))
|
type(request_payload)))
|
||||||
|
|
||||||
unique_identifier = request_payload.unique_identifier
|
unique_identifier = request_payload.unique_identifier
|
||||||
|
@ -1118,7 +1117,7 @@ class TestRequestMessage(TestCase):
|
||||||
parameters_attribute = attr.CryptographicParameters(
|
parameters_attribute = attr.CryptographicParameters(
|
||||||
cryptographic_algorithm=enums.CryptographicAlgorithm.HMAC_SHA512
|
cryptographic_algorithm=enums.CryptographicAlgorithm.HMAC_SHA512
|
||||||
)
|
)
|
||||||
request_payload = mac.MACRequestPayload(
|
request_payload = payloads.MACRequestPayload(
|
||||||
unique_identifier=uuid,
|
unique_identifier=uuid,
|
||||||
cryptographic_parameters=parameters_attribute,
|
cryptographic_parameters=parameters_attribute,
|
||||||
data=data
|
data=data
|
||||||
|
@ -1345,7 +1344,7 @@ class TestResponseMessage(TestCase):
|
||||||
result_status.value))
|
result_status.value))
|
||||||
|
|
||||||
response_payload = batch_item.response_payload
|
response_payload = batch_item.response_payload
|
||||||
exp_type = create.CreateResponsePayload
|
exp_type = payloads.CreateResponsePayload
|
||||||
rcv_type = type(response_payload)
|
rcv_type = type(response_payload)
|
||||||
self.assertIsInstance(response_payload, exp_type,
|
self.assertIsInstance(response_payload, exp_type,
|
||||||
self.msg.format('response payload', 'type',
|
self.msg.format('response payload', 'type',
|
||||||
|
@ -1387,8 +1386,10 @@ class TestResponseMessage(TestCase):
|
||||||
|
|
||||||
uuid = 'fb4b5b9c-6188-4c63-8142-fe9c328129fc'
|
uuid = 'fb4b5b9c-6188-4c63-8142-fe9c328129fc'
|
||||||
uniq_id = attr.UniqueIdentifier(uuid)
|
uniq_id = attr.UniqueIdentifier(uuid)
|
||||||
resp_pl = create.CreateResponsePayload(object_type=object_type,
|
resp_pl = payloads.CreateResponsePayload(
|
||||||
unique_identifier=uniq_id)
|
object_type=object_type,
|
||||||
|
unique_identifier=uniq_id
|
||||||
|
)
|
||||||
batch_item = messages.ResponseBatchItem(operation=operation,
|
batch_item = messages.ResponseBatchItem(operation=operation,
|
||||||
result_status=result_status,
|
result_status=result_status,
|
||||||
response_payload=resp_pl)
|
response_payload=resp_pl)
|
||||||
|
@ -1494,7 +1495,7 @@ class TestResponseMessage(TestCase):
|
||||||
result_status.value))
|
result_status.value))
|
||||||
|
|
||||||
response_payload = batch_item.response_payload
|
response_payload = batch_item.response_payload
|
||||||
exp_type = get.GetResponsePayload
|
exp_type = payloads.GetResponsePayload
|
||||||
rcv_type = type(response_payload)
|
rcv_type = type(response_payload)
|
||||||
self.assertIsInstance(response_payload, exp_type,
|
self.assertIsInstance(response_payload, exp_type,
|
||||||
self.msg.format('response payload', 'type',
|
self.msg.format('response payload', 'type',
|
||||||
|
@ -1610,9 +1611,11 @@ class TestResponseMessage(TestCase):
|
||||||
|
|
||||||
secret = SymmetricKey(key_block)
|
secret = SymmetricKey(key_block)
|
||||||
|
|
||||||
resp_pl = get.GetResponsePayload(object_type=object_type.value,
|
resp_pl = payloads.GetResponsePayload(
|
||||||
unique_identifier=uniq_id.value,
|
object_type=object_type.value,
|
||||||
secret=secret)
|
unique_identifier=uniq_id.value,
|
||||||
|
secret=secret
|
||||||
|
)
|
||||||
batch_item = messages.ResponseBatchItem(operation=operation,
|
batch_item = messages.ResponseBatchItem(operation=operation,
|
||||||
result_status=result_status,
|
result_status=result_status,
|
||||||
response_payload=resp_pl)
|
response_payload=resp_pl)
|
||||||
|
@ -1726,7 +1729,7 @@ class TestResponseMessage(TestCase):
|
||||||
|
|
||||||
response_payload = batch_item.response_payload
|
response_payload = batch_item.response_payload
|
||||||
msg = "Bad response payload type: expected {0}, received {1}"
|
msg = "Bad response payload type: expected {0}, received {1}"
|
||||||
exp_type = destroy.DestroyResponsePayload
|
exp_type = payloads.DestroyResponsePayload
|
||||||
rcv_type = type(response_payload)
|
rcv_type = type(response_payload)
|
||||||
self.assertIsInstance(response_payload, exp_type,
|
self.assertIsInstance(response_payload, exp_type,
|
||||||
msg.format(exp_type, rcv_type))
|
msg.format(exp_type, rcv_type))
|
||||||
|
@ -1757,7 +1760,7 @@ class TestResponseMessage(TestCase):
|
||||||
result_status = contents.ResultStatus(enums.ResultStatus.SUCCESS)
|
result_status = contents.ResultStatus(enums.ResultStatus.SUCCESS)
|
||||||
|
|
||||||
uuid = attr.UniqueIdentifier('fb4b5b9c-6188-4c63-8142-fe9c328129fc')
|
uuid = attr.UniqueIdentifier('fb4b5b9c-6188-4c63-8142-fe9c328129fc')
|
||||||
resp_pl = destroy.DestroyResponsePayload(unique_identifier=uuid)
|
resp_pl = payloads.DestroyResponsePayload(unique_identifier=uuid)
|
||||||
batch_item = messages.ResponseBatchItem(operation=operation,
|
batch_item = messages.ResponseBatchItem(operation=operation,
|
||||||
result_status=result_status,
|
result_status=result_status,
|
||||||
response_payload=resp_pl)
|
response_payload=resp_pl)
|
||||||
|
@ -1869,7 +1872,7 @@ class TestResponseMessage(TestCase):
|
||||||
|
|
||||||
response_payload = batch_item.response_payload
|
response_payload = batch_item.response_payload
|
||||||
msg = "Bad response payload type: expected {0}, received {1}"
|
msg = "Bad response payload type: expected {0}, received {1}"
|
||||||
exp_type = register.RegisterResponsePayload
|
exp_type = payloads.RegisterResponsePayload
|
||||||
rcv_type = type(response_payload)
|
rcv_type = type(response_payload)
|
||||||
self.assertIsInstance(response_payload, exp_type,
|
self.assertIsInstance(response_payload, exp_type,
|
||||||
msg.format(exp_type, rcv_type))
|
msg.format(exp_type, rcv_type))
|
||||||
|
@ -1900,7 +1903,7 @@ class TestResponseMessage(TestCase):
|
||||||
result_status = contents.ResultStatus(enums.ResultStatus.SUCCESS)
|
result_status = contents.ResultStatus(enums.ResultStatus.SUCCESS)
|
||||||
|
|
||||||
uuid = attr.UniqueIdentifier('5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3')
|
uuid = attr.UniqueIdentifier('5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3')
|
||||||
resp_pl = register.RegisterResponsePayload(unique_identifier=uuid)
|
resp_pl = payloads.RegisterResponsePayload(unique_identifier=uuid)
|
||||||
batch_item = messages.ResponseBatchItem(operation=operation,
|
batch_item = messages.ResponseBatchItem(operation=operation,
|
||||||
result_status=result_status,
|
result_status=result_status,
|
||||||
response_payload=resp_pl)
|
response_payload=resp_pl)
|
||||||
|
@ -1933,7 +1936,7 @@ class TestResponseMessage(TestCase):
|
||||||
result_status = contents.ResultStatus(enums.ResultStatus.SUCCESS)
|
result_status = contents.ResultStatus(enums.ResultStatus.SUCCESS)
|
||||||
uuid = attr.UniqueIdentifier('49a1ca88-6bea-4fb2-b450-7e58802c3038')
|
uuid = attr.UniqueIdentifier('49a1ca88-6bea-4fb2-b450-7e58802c3038')
|
||||||
|
|
||||||
resp_pl = locate.LocateResponsePayload(unique_identifiers=[uuid])
|
resp_pl = payloads.LocateResponsePayload(unique_identifiers=[uuid])
|
||||||
|
|
||||||
batch_item = messages.ResponseBatchItem(operation=operation,
|
batch_item = messages.ResponseBatchItem(operation=operation,
|
||||||
result_status=result_status,
|
result_status=result_status,
|
||||||
|
@ -2041,7 +2044,7 @@ class TestResponseMessage(TestCase):
|
||||||
result_status.value))
|
result_status.value))
|
||||||
|
|
||||||
response_payload = batch_item.response_payload
|
response_payload = batch_item.response_payload
|
||||||
exp_type = mac.MACResponsePayload
|
exp_type = payloads.MACResponsePayload
|
||||||
rcv_type = type(response_payload)
|
rcv_type = type(response_payload)
|
||||||
self.assertIsInstance(response_payload, exp_type,
|
self.assertIsInstance(response_payload, exp_type,
|
||||||
self.msg.format('response payload', 'type',
|
self.msg.format('response payload', 'type',
|
||||||
|
@ -2103,8 +2106,10 @@ class TestResponseMessage(TestCase):
|
||||||
b'\xff\x7c')
|
b'\xff\x7c')
|
||||||
mac_data = objects.MACData(value)
|
mac_data = objects.MACData(value)
|
||||||
|
|
||||||
resp_pl = mac.MACResponsePayload(unique_identifier=uniq_id,
|
resp_pl = payloads.MACResponsePayload(
|
||||||
mac_data=mac_data)
|
unique_identifier=uniq_id,
|
||||||
|
mac_data=mac_data
|
||||||
|
)
|
||||||
batch_item = messages.ResponseBatchItem(operation=operation,
|
batch_item = messages.ResponseBatchItem(operation=operation,
|
||||||
result_status=result_status,
|
result_status=result_status,
|
||||||
response_payload=resp_pl)
|
response_payload=resp_pl)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -42,21 +42,7 @@ from kmip.core.messages.contents import ResultStatus
|
||||||
from kmip.core.messages.contents import ResultReason
|
from kmip.core.messages.contents import ResultReason
|
||||||
from kmip.core.messages.contents import ResultMessage
|
from kmip.core.messages.contents import ResultMessage
|
||||||
from kmip.core.messages.contents import ProtocolVersion
|
from kmip.core.messages.contents import ProtocolVersion
|
||||||
from kmip.core.messages.payloads.create_key_pair import \
|
from kmip.core.messages import payloads
|
||||||
CreateKeyPairRequestPayload, CreateKeyPairResponsePayload
|
|
||||||
from kmip.core.messages.payloads import decrypt
|
|
||||||
from kmip.core.messages.payloads import derive_key
|
|
||||||
from kmip.core.messages.payloads.discover_versions import \
|
|
||||||
DiscoverVersionsRequestPayload, DiscoverVersionsResponsePayload
|
|
||||||
from kmip.core.messages.payloads import encrypt
|
|
||||||
from kmip.core.messages.payloads import get_attributes
|
|
||||||
from kmip.core.messages.payloads import get_attribute_list
|
|
||||||
from kmip.core.messages.payloads.query import \
|
|
||||||
QueryRequestPayload, QueryResponsePayload
|
|
||||||
from kmip.core.messages.payloads.rekey_key_pair import \
|
|
||||||
RekeyKeyPairRequestPayload, RekeyKeyPairResponsePayload
|
|
||||||
from kmip.core.messages.payloads import sign
|
|
||||||
from kmip.core.messages.payloads import signature_verify
|
|
||||||
|
|
||||||
from kmip.core.misc import Offset
|
from kmip.core.misc import Offset
|
||||||
from kmip.core.misc import QueryFunction
|
from kmip.core.misc import QueryFunction
|
||||||
|
@ -236,8 +222,12 @@ class TestKMIPClient(TestCase):
|
||||||
|
|
||||||
payload = batch_item.request_payload
|
payload = batch_item.request_payload
|
||||||
|
|
||||||
msg = base.format(CreateKeyPairRequestPayload, payload)
|
msg = base.format(payloads.CreateKeyPairRequestPayload, payload)
|
||||||
self.assertIsInstance(payload, CreateKeyPairRequestPayload, msg)
|
self.assertIsInstance(
|
||||||
|
payload,
|
||||||
|
payloads.CreateKeyPairRequestPayload,
|
||||||
|
msg
|
||||||
|
)
|
||||||
|
|
||||||
common_observed = payload.common_template_attribute
|
common_observed = payload.common_template_attribute
|
||||||
private_observed = payload.private_key_template_attribute
|
private_observed = payload.private_key_template_attribute
|
||||||
|
@ -285,8 +275,12 @@ class TestKMIPClient(TestCase):
|
||||||
|
|
||||||
payload = batch_item.request_payload
|
payload = batch_item.request_payload
|
||||||
|
|
||||||
msg = base.format(RekeyKeyPairRequestPayload, payload)
|
msg = base.format(payloads.RekeyKeyPairRequestPayload, payload)
|
||||||
self.assertIsInstance(payload, RekeyKeyPairRequestPayload, msg)
|
self.assertIsInstance(
|
||||||
|
payload,
|
||||||
|
payloads.RekeyKeyPairRequestPayload,
|
||||||
|
msg
|
||||||
|
)
|
||||||
|
|
||||||
private_key_uuid_observed = payload.private_key_uuid
|
private_key_uuid_observed = payload.private_key_uuid
|
||||||
offset_observed = payload.offset
|
offset_observed = payload.offset
|
||||||
|
@ -342,8 +336,8 @@ class TestKMIPClient(TestCase):
|
||||||
if query_functions is None:
|
if query_functions is None:
|
||||||
query_functions = list()
|
query_functions = list()
|
||||||
|
|
||||||
msg = base.format(QueryRequestPayload, payload)
|
msg = base.format(payloads.QueryRequestPayload, payload)
|
||||||
self.assertIsInstance(payload, QueryRequestPayload, msg)
|
self.assertIsInstance(payload, payloads.QueryRequestPayload, msg)
|
||||||
|
|
||||||
query_functions_observed = payload.query_functions
|
query_functions_observed = payload.query_functions
|
||||||
self.assertEqual(query_functions, query_functions_observed)
|
self.assertEqual(query_functions, query_functions_observed)
|
||||||
|
@ -378,8 +372,12 @@ class TestKMIPClient(TestCase):
|
||||||
if protocol_versions is None:
|
if protocol_versions is None:
|
||||||
protocol_versions = list()
|
protocol_versions = list()
|
||||||
|
|
||||||
msg = base.format(DiscoverVersionsRequestPayload, payload)
|
msg = base.format(payloads.DiscoverVersionsRequestPayload, payload)
|
||||||
self.assertIsInstance(payload, DiscoverVersionsRequestPayload, msg)
|
self.assertIsInstance(
|
||||||
|
payload,
|
||||||
|
payloads.DiscoverVersionsRequestPayload,
|
||||||
|
msg
|
||||||
|
)
|
||||||
|
|
||||||
observed = payload.protocol_versions
|
observed = payload.protocol_versions
|
||||||
|
|
||||||
|
@ -413,7 +411,7 @@ class TestKMIPClient(TestCase):
|
||||||
)
|
)
|
||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
batch_item.request_payload,
|
batch_item.request_payload,
|
||||||
get_attributes.GetAttributesRequestPayload
|
payloads.GetAttributesRequestPayload
|
||||||
)
|
)
|
||||||
self.assertEqual(uuid, batch_item.request_payload.unique_identifier)
|
self.assertEqual(uuid, batch_item.request_payload.unique_identifier)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -431,13 +429,13 @@ class TestKMIPClient(TestCase):
|
||||||
OperationEnum.GET_ATTRIBUTE_LIST, batch_item.operation.value)
|
OperationEnum.GET_ATTRIBUTE_LIST, batch_item.operation.value)
|
||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
batch_item.request_payload,
|
batch_item.request_payload,
|
||||||
get_attribute_list.GetAttributeListRequestPayload)
|
payloads.GetAttributeListRequestPayload)
|
||||||
self.assertEqual(uid, batch_item.request_payload.unique_identifier)
|
self.assertEqual(uid, batch_item.request_payload.unique_identifier)
|
||||||
|
|
||||||
def test_process_batch_items(self):
|
def test_process_batch_items(self):
|
||||||
batch_item = ResponseBatchItem(
|
batch_item = ResponseBatchItem(
|
||||||
operation=Operation(OperationEnum.CREATE_KEY_PAIR),
|
operation=Operation(OperationEnum.CREATE_KEY_PAIR),
|
||||||
response_payload=CreateKeyPairResponsePayload())
|
response_payload=payloads.CreateKeyPairResponsePayload())
|
||||||
response = ResponseMessage(batch_items=[batch_item, batch_item])
|
response = ResponseMessage(batch_items=[batch_item, batch_item])
|
||||||
results = self.client._process_batch_items(response)
|
results = self.client._process_batch_items(response)
|
||||||
|
|
||||||
|
@ -522,7 +520,7 @@ class TestKMIPClient(TestCase):
|
||||||
def test_process_create_key_pair_batch_item(self):
|
def test_process_create_key_pair_batch_item(self):
|
||||||
batch_item = ResponseBatchItem(
|
batch_item = ResponseBatchItem(
|
||||||
operation=Operation(OperationEnum.CREATE_KEY_PAIR),
|
operation=Operation(OperationEnum.CREATE_KEY_PAIR),
|
||||||
response_payload=CreateKeyPairResponsePayload())
|
response_payload=payloads.CreateKeyPairResponsePayload())
|
||||||
result = self.client._process_create_key_pair_batch_item(batch_item)
|
result = self.client._process_create_key_pair_batch_item(batch_item)
|
||||||
|
|
||||||
msg = "expected {0}, received {1}".format(CreateKeyPairResult, result)
|
msg = "expected {0}, received {1}".format(CreateKeyPairResult, result)
|
||||||
|
@ -531,7 +529,7 @@ class TestKMIPClient(TestCase):
|
||||||
def test_process_rekey_key_pair_batch_item(self):
|
def test_process_rekey_key_pair_batch_item(self):
|
||||||
batch_item = ResponseBatchItem(
|
batch_item = ResponseBatchItem(
|
||||||
operation=Operation(OperationEnum.REKEY_KEY_PAIR),
|
operation=Operation(OperationEnum.REKEY_KEY_PAIR),
|
||||||
response_payload=RekeyKeyPairResponsePayload())
|
response_payload=payloads.RekeyKeyPairResponsePayload())
|
||||||
result = self.client._process_rekey_key_pair_batch_item(batch_item)
|
result = self.client._process_rekey_key_pair_batch_item(batch_item)
|
||||||
|
|
||||||
msg = "expected {0}, received {1}".format(RekeyKeyPairResult, result)
|
msg = "expected {0}, received {1}".format(RekeyKeyPairResult, result)
|
||||||
|
@ -546,7 +544,7 @@ class TestKMIPClient(TestCase):
|
||||||
application_namespaces,
|
application_namespaces,
|
||||||
extension_information):
|
extension_information):
|
||||||
|
|
||||||
payload = QueryResponsePayload(
|
payload = payloads.QueryResponsePayload(
|
||||||
operations,
|
operations,
|
||||||
object_types,
|
object_types,
|
||||||
vendor_identification,
|
vendor_identification,
|
||||||
|
@ -598,7 +596,7 @@ class TestKMIPClient(TestCase):
|
||||||
def _test_process_discover_versions_batch_item(self, protocol_versions):
|
def _test_process_discover_versions_batch_item(self, protocol_versions):
|
||||||
batch_item = ResponseBatchItem(
|
batch_item = ResponseBatchItem(
|
||||||
operation=Operation(OperationEnum.DISCOVER_VERSIONS),
|
operation=Operation(OperationEnum.DISCOVER_VERSIONS),
|
||||||
response_payload=DiscoverVersionsResponsePayload(
|
response_payload=payloads.DiscoverVersionsResponsePayload(
|
||||||
protocol_versions))
|
protocol_versions))
|
||||||
result = self.client._process_discover_versions_batch_item(batch_item)
|
result = self.client._process_discover_versions_batch_item(batch_item)
|
||||||
|
|
||||||
|
@ -624,7 +622,7 @@ class TestKMIPClient(TestCase):
|
||||||
def test_process_get_attributes_batch_item(self):
|
def test_process_get_attributes_batch_item(self):
|
||||||
uuid = '00000000-1111-2222-3333-444444444444'
|
uuid = '00000000-1111-2222-3333-444444444444'
|
||||||
attributes = []
|
attributes = []
|
||||||
payload = get_attributes.GetAttributesResponsePayload(
|
payload = payloads.GetAttributesResponsePayload(
|
||||||
unique_identifier=uuid,
|
unique_identifier=uuid,
|
||||||
attributes=attributes
|
attributes=attributes
|
||||||
)
|
)
|
||||||
|
@ -641,7 +639,7 @@ class TestKMIPClient(TestCase):
|
||||||
def test_process_get_attribute_list_batch_item(self):
|
def test_process_get_attribute_list_batch_item(self):
|
||||||
uid = '00000000-1111-2222-3333-444444444444'
|
uid = '00000000-1111-2222-3333-444444444444'
|
||||||
names = ['Cryptographic Algorithm', 'Cryptographic Length']
|
names = ['Cryptographic Algorithm', 'Cryptographic Length']
|
||||||
payload = get_attribute_list.GetAttributeListResponsePayload(
|
payload = payloads.GetAttributeListResponsePayload(
|
||||||
unique_identifier=uid, attribute_names=names)
|
unique_identifier=uid, attribute_names=names)
|
||||||
batch_item = ResponseBatchItem(
|
batch_item = ResponseBatchItem(
|
||||||
operation=Operation(OperationEnum.GET_ATTRIBUTE_LIST),
|
operation=Operation(OperationEnum.GET_ATTRIBUTE_LIST),
|
||||||
|
@ -735,7 +733,7 @@ class TestKMIPClient(TestCase):
|
||||||
"""
|
"""
|
||||||
Test that the client can derive a key.
|
Test that the client can derive a key.
|
||||||
"""
|
"""
|
||||||
payload = derive_key.DeriveKeyResponsePayload(
|
payload = payloads.DeriveKeyResponsePayload(
|
||||||
unique_identifier='1',
|
unique_identifier='1',
|
||||||
)
|
)
|
||||||
batch_item = ResponseBatchItem(
|
batch_item = ResponseBatchItem(
|
||||||
|
@ -793,7 +791,7 @@ class TestKMIPClient(TestCase):
|
||||||
"""
|
"""
|
||||||
Test that the client can encrypt data.
|
Test that the client can encrypt data.
|
||||||
"""
|
"""
|
||||||
payload = encrypt.EncryptResponsePayload(
|
payload = payloads.EncryptResponsePayload(
|
||||||
unique_identifier='1',
|
unique_identifier='1',
|
||||||
data=(
|
data=(
|
||||||
b'\x6B\x77\xB4\xD6\x30\x06\xDE\xE6'
|
b'\x6B\x77\xB4\xD6\x30\x06\xDE\xE6'
|
||||||
|
@ -856,7 +854,7 @@ class TestKMIPClient(TestCase):
|
||||||
"""
|
"""
|
||||||
Test that the client can decrypt data.
|
Test that the client can decrypt data.
|
||||||
"""
|
"""
|
||||||
payload = decrypt.DecryptResponsePayload(
|
payload = payloads.DecryptResponsePayload(
|
||||||
unique_identifier='1',
|
unique_identifier='1',
|
||||||
data=(
|
data=(
|
||||||
b'\x37\x36\x35\x34\x33\x32\x31\x20'
|
b'\x37\x36\x35\x34\x33\x32\x31\x20'
|
||||||
|
@ -918,7 +916,7 @@ class TestKMIPClient(TestCase):
|
||||||
"""
|
"""
|
||||||
Test that the client can verify a signature.
|
Test that the client can verify a signature.
|
||||||
"""
|
"""
|
||||||
payload = signature_verify.SignatureVerifyResponsePayload(
|
payload = payloads.SignatureVerifyResponsePayload(
|
||||||
unique_identifier='1',
|
unique_identifier='1',
|
||||||
validity_indicator=enums.ValidityIndicator.INVALID
|
validity_indicator=enums.ValidityIndicator.INVALID
|
||||||
)
|
)
|
||||||
|
@ -972,7 +970,7 @@ class TestKMIPClient(TestCase):
|
||||||
"""
|
"""
|
||||||
Test that the client can sign data
|
Test that the client can sign data
|
||||||
"""
|
"""
|
||||||
payload = sign.SignResponsePayload(
|
payload = payloads.SignResponsePayload(
|
||||||
unique_identifier='1',
|
unique_identifier='1',
|
||||||
signature_data=b'aaaaaaaaaaaaaaaa'
|
signature_data=b'aaaaaaaaaaaaaaaa'
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue