コード例 #1
0
    def test_store_success(self):
        context = self.get_context()

        cert, key, _ = create_certificate(context.pub_key_payload,
                                          signer=context.client.get_signer())
        cert_address, transaction_payload = self._pre_parse_payload_and_exec(
            context, cert, key)
        crt_export, crt_bin, crt_sig, rem_sig, pub_key, \
            valid_from, valid_to = get_crt_export_bin_sig_rem_sig(cert, key, context.client)

        account = AccountClient.get_account_model(PUB_KEY_STORE_PRICE)

        data = PubKeyStorage()
        data.owner = self.account_signer1.get_public_key().as_hex()
        data.payload.CopyFrom(transaction_payload)
        data.revoked = False

        self.expect_get({cert_address: None, self.account_address1: account})
        self.expect_get({_make_settings_key('remme.economy_enabled'): None})

        context.client.store_pub_key(pub_key, rem_sig, crt_sig, valid_from,
                                     valid_to)

        account.balance -= PUB_KEY_STORE_PRICE
        account.pub_keys.append(cert_address)

        self.expect_set({self.account_address1: account, cert_address: data})

        self.expect_ok()
コード例 #2
0
ファイル: test_pub_key.py プロジェクト: CFisch2/remme-core
    def test_revoke_fail_wrong_signer(self):
        context = self.get_context()

        cert, key, key_export = create_certificate(context.pub_key_payload,
                                                   org_name='different',
                                                   signer=self.account_signer2)
        cert_address, transaction_payload = self._pre_parse_payload_and_exec(context, cert, key, 'revoke')

        data = PubKeyStorage()
        data.owner = self.account_signer2.get_public_key().as_hex()
        data.payload.CopyFrom(transaction_payload)
        data.revoked = False

        self.expect_get({cert_address: data})

        self.expect_invalid_transaction()
コード例 #3
0
ファイル: test_pub_key.py プロジェクト: CFisch2/remme-core
    def test_store_fail_invalid_validity_date(self):
        context = self.get_context()

        cert, key, _ = create_certificate(context.pub_key_payload, signer=context.client.get_signer())
        crt_export, crt_bin, crt_sig, rem_sig, pub_key, \
            valid_from, valid_to = get_crt_export_bin_sig_rem_sig(cert, key, context.client)

        cert_address = PubKeyHandler.make_address_from_data(pub_key)

        valid_from = int(valid_from - PUB_KEY_MAX_VALIDITY.total_seconds())
        valid_to = int(valid_to + PUB_KEY_MAX_VALIDITY.total_seconds())

        context.client.store_pub_key(pub_key, rem_sig, crt_sig, valid_from, valid_to)

        self.expect_get({cert_address: None})

        self.expect_invalid_transaction()
コード例 #4
0
ファイル: test_pub_key.py プロジェクト: CFisch2/remme-core
    def test_store_success(self):
        context = self.get_context()

        cert, key, _ = create_certificate(context.pub_key_payload, signer=context.client.get_signer())
        cert_address, transaction_payload = self._pre_parse_payload_and_exec(context, cert, key)
        self.expect_get({cert_address: None})

        account = AccountClient.get_account_model(PUB_KEY_STORE_PRICE)
        self.expect_get({self.account_address1: account})

        data = PubKeyStorage()
        data.owner = self.account_signer1.get_public_key().as_hex()
        data.payload.CopyFrom(transaction_payload)
        data.revoked = False

        account.balance -= PUB_KEY_STORE_PRICE
        account.pub_keys.append(cert_address)

        self.expect_set({
            self.account_address1: account,
            cert_address: data
        })

        self.expect_ok()