mirror of
https://github.com/planetmint/planetmint.git
synced 2025-06-06 14:16:38 +00:00
Resolve flake8 issues#2
Signed-off-by: Sangat Das <sangatdas5@gmail.com>
This commit is contained in:
parent
0463fb22f9
commit
43ecbffe5e
@ -97,7 +97,6 @@ def test_single_in_single_own_multiple_out_mix_own_create(alice, user_pk, b):
|
||||
# Output combinations already tested above
|
||||
def test_single_in_multiple_own_single_out_single_own_create(alice, b, user_pk,
|
||||
user_sk):
|
||||
|
||||
from planetmint.transactions.common.utils import _fulfillment_to_details
|
||||
|
||||
tx = Create.generate([alice.public_key, user_pk], [([user_pk], 100)], asset={'name': random.random()})
|
||||
@ -305,8 +304,9 @@ def test_multiple_in_single_own_single_out_single_own_transfer(alice, b, user_pk
|
||||
# Multiple owners_before per input
|
||||
# Single output
|
||||
# Single owners_after
|
||||
def test_multiple_in_multiple_own_single_out_single_own_transfer(alice, b, user_pk,
|
||||
user_sk):
|
||||
def test_multiple_in_multiple_own_single_out_single_own_transfer(
|
||||
alice, b, user_pk,
|
||||
user_sk):
|
||||
from planetmint.transactions.common.utils import _fulfillment_to_details
|
||||
|
||||
# CREATE divisible asset
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
import codecs
|
||||
from planetmint.transactions.types.assets.create import Create
|
||||
from planetmint.transactions.types.assets.transfer import Transfer
|
||||
|
||||
from tendermint.abci import types_pb2 as types
|
||||
import json
|
||||
@ -114,7 +115,7 @@ def test_app(b, eventqueue_fixture, init_chain_request):
|
||||
@pytest.mark.abci
|
||||
def test_post_transaction_responses(tendermint_ws_url, b):
|
||||
from planetmint.transactions.common.crypto import generate_key_pair
|
||||
from planetmint.models import Transaction
|
||||
|
||||
|
||||
alice = generate_key_pair()
|
||||
bob = generate_key_pair()
|
||||
@ -126,7 +127,7 @@ def test_post_transaction_responses(tendermint_ws_url, b):
|
||||
code, message = b.write_transaction(tx, BROADCAST_TX_COMMIT)
|
||||
assert code == 202
|
||||
|
||||
tx_transfer = Transaction.transfer(tx.to_inputs(),
|
||||
tx_transfer = Transfer.generate(tx.to_inputs(),
|
||||
[([bob.public_key], 1)],
|
||||
asset_id=tx.id)\
|
||||
.sign([alice.private_key])
|
||||
@ -135,7 +136,7 @@ def test_post_transaction_responses(tendermint_ws_url, b):
|
||||
assert code == 202
|
||||
|
||||
carly = generate_key_pair()
|
||||
double_spend = Transaction.transfer(
|
||||
double_spend = Transfer.transfer(
|
||||
tx.to_inputs(),
|
||||
[([carly.public_key], 1)],
|
||||
asset_id=tx.id,
|
||||
|
@ -13,6 +13,7 @@ from planetmint.backend.localmongodb.connection import LocalMongoDBConnection
|
||||
from planetmint.backend.schema import TABLES
|
||||
from planetmint.transactions.common import crypto
|
||||
from planetmint.transactions.common.transaction_mode_types import BROADCAST_TX_COMMIT
|
||||
from planetmint.transactions.types.assets.create import Create
|
||||
from planetmint.transactions.types.elections.election import Election, Vote
|
||||
from planetmint.tendermint_utils import key_to_base64
|
||||
|
||||
@ -30,10 +31,9 @@ def flush_localmongo_db(connection, dbname):
|
||||
|
||||
def generate_block(planet):
|
||||
from planetmint.transactions.common.crypto import generate_key_pair
|
||||
from planetmint.models import Transaction
|
||||
|
||||
alice = generate_key_pair()
|
||||
tx = Transaction.create([alice.public_key],
|
||||
tx = Create.generate([alice.public_key],
|
||||
[([alice.public_key], 1)],
|
||||
asset=None)\
|
||||
.sign([alice.private_key])
|
||||
|
@ -3,7 +3,10 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
||||
import pytest
|
||||
from planetmint.transactions.types.assets.create import Create
|
||||
from planetmint.transactions.types.assets.transfer import Transfer
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
|
||||
@ -83,7 +86,6 @@ def test_get_outputs_endpoint_with_invalid_spent(client, user_pk):
|
||||
|
||||
@pytest.mark.abci
|
||||
def test_get_divisble_transactions_returns_500(b, client):
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.transactions.common import crypto
|
||||
import json
|
||||
|
||||
@ -96,7 +98,7 @@ def test_get_divisble_transactions_returns_500(b, client):
|
||||
bob_priv, bob_pub = crypto.generate_key_pair()
|
||||
carly_priv, carly_pub = crypto.generate_key_pair()
|
||||
|
||||
create_tx = Transaction.create([alice_pub], [([alice_pub], 4)])
|
||||
create_tx = Create.generate([alice_pub], [([alice_pub], 4)])
|
||||
create_tx.sign([alice_priv])
|
||||
|
||||
res = client.post(TX_ENDPOINT, data=json.dumps(create_tx.to_dict()))
|
||||
@ -104,7 +106,7 @@ def test_get_divisble_transactions_returns_500(b, client):
|
||||
|
||||
mine([create_tx])
|
||||
|
||||
transfer_tx = Transaction.transfer(create_tx.to_inputs(),
|
||||
transfer_tx = Transfer.generate(create_tx.to_inputs(),
|
||||
[([alice_pub], 3), ([bob_pub], 1)],
|
||||
asset_id=create_tx.id)
|
||||
transfer_tx.sign([alice_priv])
|
||||
@ -114,7 +116,7 @@ def test_get_divisble_transactions_returns_500(b, client):
|
||||
|
||||
mine([transfer_tx])
|
||||
|
||||
transfer_tx_carly = Transaction.transfer([transfer_tx.to_inputs()[1]],
|
||||
transfer_tx_carly = Transfer.generate([transfer_tx.to_inputs()[1]],
|
||||
[([carly_pub], 1)],
|
||||
asset_id=create_tx.id)
|
||||
transfer_tx_carly.sign([bob_priv])
|
||||
|
Loading…
x
Reference in New Issue
Block a user