def test_deploy_info_from_bytes_to_bytes_none_check(self):
        score_address = create_address(1)
        owner_address = create_address()
        tx_hash1 = create_tx_hash()
        tx_hash2 = ZERO_TX_HASH
        deploy_state = DeployState.INACTIVE

        info1 = IconScoreDeployInfo(score_address, deploy_state, owner_address,
                                    tx_hash1, tx_hash2)

        data = IconScoreDeployInfo.to_bytes(info1)
        self.assertTrue(isinstance(data, bytes))

        info2 = IconScoreDeployInfo.from_bytes(data)
        self.assertEqual(info2.score_address, score_address)
        self.assertEqual(info2.deploy_state, deploy_state)
        self.assertEqual(info2.owner, owner_address)
        self.assertEqual(info2.current_tx_hash, tx_hash1)
        self.assertEqual(info2.next_tx_hash, tx_hash2)
예제 #2
0
 def _convert_deploy_info(cls, key: bytes, value: bytes) -> Tuple[str, str]:
     bytes_address: bytes = key[len(DeployStorage.
                                    _DEPLOY_STORAGE_DEPLOY_INFO_PREFIX):]
     converted_key: str = f"Deploy SCORE: {Address.from_bytes(bytes_address)}"
     converted_value: str = str(IconScoreDeployInfo.from_bytes(value))
     return converted_key, converted_value