def test_read_with_known_uuid(self): """ Test that a RevokeResponsePayload object with known UUID can be read from a data stream. """ payload = payloads.RevokeResponsePayload() payload.read(self.encoding_a) expected = '668eff89-3010-4258-bc0e-8c402309c746' observed = payload.unique_identifier.value msg = "Revoke UUID value mismatch" msg += "; expected {0}, received {1}".format(expected, observed) self.assertEqual(expected, observed, msg)
def test_write_with_known_uuid(self): """ Test that a RevokeResponsePayload object with a known UUID can be written to a data stream. """ stream = utils.BytearrayStream() payload = payloads.RevokeResponsePayload(self.uuid) payload.write(stream) length_expected = len(self.encoding_a) length_received = len(stream) msg = "encoding lengths not equal" msg += "; expected {0}, received {1}".format(length_expected, length_received) self.assertEqual(length_expected, length_received, msg) msg = "encoding mismatch" msg += ";\nexpected:\n{0}\nreceived:\n{1}".format( self.encoding_a, stream) self.assertEqual(self.encoding_a, stream, msg)
def test_init_with_none(self): """ Test that a RevokeResponsePayload object can be constructed with no specified value. """ payloads.RevokeResponsePayload()
def test_init_with_args(self): """ Test that a RevokeResponsePayload object can be constructed with valid values. """ payloads.RevokeResponsePayload(unique_identifier=self.uuid)
def _create_revoke_payload(self): return payloads.RevokeResponsePayload()