Example #1
0
    def test_verify_serialized_signup_info(self):
        signup_info = \
            SignupInfo.create_signup_info(
                self._create_random_public_key())
        serialized = signup_info.serialize()
        copy_signup_info = SignupInfo.signup_info_from_serialized(serialized)

        self.assertEqual(signup_info.poet_public_key,
                         copy_signup_info.poet_public_key)
        self.assertEqual(signup_info.anti_sybil_id,
                         copy_signup_info.anti_sybil_id)
        self.assertEqual(signup_info.proof_data, copy_signup_info.proof_data)
        self.assertIsNone(copy_signup_info.sealed_signup_data)
    def test_verify_serialized_signup_info(self):
        signup_info = \
            SignupInfo.create_signup_info(
                originator_public_key=self._originator_public_key,
                validator_network_basename='This is CNN.',
                most_recent_wait_certificate_id=NullIdentifier)
        serialized = signup_info.serialize()
        copy_signup_info = SignupInfo.signup_info_from_serialized(serialized)

        self.assertEqual(signup_info.poet_public_key,
                         copy_signup_info.poet_public_key)
        self.assertEqual(signup_info.proof_data, copy_signup_info.proof_data)
        self.assertIsNone(copy_signup_info.sealed_signup_data)
    def test_verify_serialized_signup_info(self):
        signup_info = \
            SignupInfo.create_signup_info(
                originator_public_key_hash=self._originator_public_key_hash,
                most_recent_wait_certificate_id=NullIdentifier)
        serialized = signup_info.serialize()
        copy_signup_info = SignupInfo.signup_info_from_serialized(serialized)

        self.assertEqual(signup_info.poet_public_key,
                         copy_signup_info.poet_public_key)
        self.assertEqual(signup_info.proof_data, copy_signup_info.proof_data)
        self.assertEqual(signup_info.anti_sybil_id,
                         copy_signup_info.anti_sybil_id)
        self.assertIsNone(copy_signup_info.sealed_signup_data)
    def test_verify_serialized_signup_info(self):
        signup_info = \
            SignupInfo.create_signup_info(
                originator_public_key=self._originator_public_key,
                validator_network_basename='This is CNN.',
                most_recent_wait_certificate_id=NullIdentifier)
        serialized = signup_info.serialize()
        copy_signup_info = SignupInfo.signup_info_from_serialized(serialized)

        self.assertEqual(
            signup_info.poet_public_key,
            copy_signup_info.poet_public_key)
        self.assertEqual(signup_info.proof_data, copy_signup_info.proof_data)
        self.assertIsNone(copy_signup_info.sealed_signup_data)
    def __init__(self, minfo=None):
        """Constructor for Update class.

        Args:
            minfo (dict): Update values extracted from a message
                {'verb', 'validator_name', 'validator_id', 'signup_info'}
        """

        if minfo is None:
            minfo = {}
        self.verb = minfo.get('verb', 'reg')
        self.validator_name = minfo.get('validator_name', '')
        self.validator_id = minfo.get('validator_id', NullIdentifier)
        self.signup_info = \
            SignupInfo.signup_info_from_serialized(minfo.get('signup_info'))