コード例 #1
0
ファイル: test_deposit_meta.py プロジェクト: bccenter/SSI
    def test_deposit_meta_to_bytes_from_bytes_with_none_type(self):
        deposit_meta = DepositMeta()
        deposit_meta_in_bytes = deposit_meta.to_bytes()
        self.assertIsInstance(deposit_meta_in_bytes, bytes)

        deposit_meta_2 = DepositMeta.from_bytes(deposit_meta_in_bytes)
        self.assertIsInstance(deposit_meta_2, DepositMeta)
        self.assertEqual(deposit_meta, deposit_meta_2)
コード例 #2
0
def test_deposit_meta_to_bytes_from_bytes_with_none_type():
    deposit_meta = DepositMeta()
    deposit_meta_in_bytes = deposit_meta.to_bytes()
    assert isinstance(deposit_meta_in_bytes, bytes)

    deposit_meta_2 = DepositMeta.from_bytes(deposit_meta_in_bytes)
    assert isinstance(deposit_meta_2, DepositMeta)
    assert deposit_meta == deposit_meta_2
コード例 #3
0
def test_get_put_delete_score_fee_with_none_type(context, storage):
    score_address = create_address(AddressPrefix.CONTRACT)

    deposit_meta = DepositMeta()
    storage.put_deposit_meta(context, score_address, deposit_meta)

    deposit_meta_2 = storage.get_deposit_meta(context, score_address)
    assert deposit_meta == deposit_meta_2

    storage.delete_deposit_meta(context, score_address)
    deposit_meta_2 = storage.get_deposit_meta(context, score_address)
    assert deposit_meta_2 is None
コード例 #4
0
    def test_get_put_delete_score_fee_with_none_type(self):
        context = self.context
        score_address = create_address(AddressPrefix.CONTRACT)

        deposit_meta = DepositMeta()
        self.storage.put_deposit_meta(context, score_address, deposit_meta)

        deposit_meta_2 = self.storage.get_deposit_meta(context, score_address)
        self.assertEqual(deposit_meta, deposit_meta_2)

        self.storage.delete_deposit_meta(context, score_address)
        deposit_meta_2 = self.storage.get_deposit_meta(context, score_address)
        self.assertIsNone(deposit_meta_2)
コード例 #5
0
def test_get_put_delete_score_fee(context, storage):
    score_address = create_address(AddressPrefix.CONTRACT)

    deposit_meta = DepositMeta()
    deposit_meta.head_id = create_tx_hash()
    deposit_meta.tail_id = create_tx_hash()
    deposit_meta.available_head_id_of_deposit = create_tx_hash()
    deposit_meta.available_head_id_of_virtual_step = create_tx_hash()
    storage.put_deposit_meta(context, score_address, deposit_meta)

    deposit_meta_2 = storage.get_deposit_meta(context, score_address)
    assert deposit_meta == deposit_meta_2

    storage.delete_deposit_meta(context, score_address)
    deposit_meta_2 = storage.get_deposit_meta(context, score_address)
    assert deposit_meta_2 is None
コード例 #6
0
ファイル: test_deposit_meta.py プロジェクト: bccenter/SSI
    def test_deposit_meta_from_bytes_to_bytes(self):
        deposit_meta = DepositMeta()
        deposit_meta.head_id = create_tx_hash()
        deposit_meta.tail_id = create_tx_hash()
        deposit_meta.available_head_id_of_deposit = create_tx_hash()
        deposit_meta.available_head_id_of_virtual_step = create_tx_hash()
        deposit_meta.expires_of_deposit = 1
        deposit_meta.expires_of_virtual_step = 200
        deposit_meta.version = 3

        deposit_meta_in_bytes = deposit_meta.to_bytes()
        self.assertIsInstance(deposit_meta_in_bytes, bytes)

        deposit_meta_2 = DepositMeta.from_bytes(deposit_meta_in_bytes)
        self.assertIsInstance(deposit_meta_2, DepositMeta)
        self.assertEqual(deposit_meta, deposit_meta_2)
コード例 #7
0
    def test_get_put_delete_score_fee(self):
        context = self.context
        score_address = create_address(AddressPrefix.CONTRACT)

        deposit_meta = DepositMeta()
        deposit_meta.head_id = create_tx_hash()
        deposit_meta.tail_id = create_tx_hash()
        deposit_meta.available_head_id_of_deposit = create_tx_hash()
        deposit_meta.available_head_id_of_virtual_step = create_tx_hash()
        self.storage.put_deposit_meta(context, score_address, deposit_meta)

        deposit_meta_2 = self.storage.get_deposit_meta(context, score_address)
        self.assertEqual(deposit_meta, deposit_meta_2)

        self.storage.delete_deposit_meta(context, score_address)
        deposit_meta_2 = self.storage.get_deposit_meta(context, score_address)
        self.assertIsNone(deposit_meta_2)