Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add submit-api testing to TestMinting #2000

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions cardano_node_tests/tests/test_native_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from cardano_node_tests.utils import dbsync_utils
from cardano_node_tests.utils import helpers
from cardano_node_tests.utils import logfiles
from cardano_node_tests.utils import submit_api
from cardano_node_tests.utils import submit_utils
from cardano_node_tests.utils import tx_view
from cardano_node_tests.utils.versions import VERSIONS
Expand Down Expand Up @@ -547,6 +548,7 @@ def test_minting_burning_diff_tokens_single_tx(
dbsync_utils.check_tx(cluster_obj=cluster, tx_raw_output=tx_out_burn2)

@allure.link(helpers.get_vcs_link())
@submit_utils.PARAM_SUBMIT_METHOD
@common.PARAM_USE_BUILD_CMD
@pytest.mark.smoke
@pytest.mark.dbsync
Expand All @@ -555,6 +557,7 @@ def test_minting_burning_same_token_single_tx(
cluster: clusterlib.ClusterLib,
issuers_addrs: tp.List[clusterlib.AddressRecord],
use_build_cmd: bool,
submit_method: str,
):
"""Test minting one token and burning the same token in single transaction.

Expand Down Expand Up @@ -647,7 +650,12 @@ def test_minting_burning_same_token_single_tx(
)

# submit signed transaction
cluster.g_transaction.submit_tx(tx_file=out_file_signed, txins=tx_output.txins)
submit_utils.submit_tx(
submit_method=submit_method,
cluster_obj=cluster,
tx_file=out_file_signed,
txins=tx_output.txins,
)

token_utxo = cluster.g_query.get_utxo(tx_raw_output=tx_output, coins=[token])
assert token_utxo and token_utxo[0].amount == 1, "The token was not minted"
Expand All @@ -660,6 +668,7 @@ def test_minting_burning_same_token_single_tx(
dbsync_utils.check_tx(cluster_obj=cluster, tx_raw_output=tx_output)

@allure.link(helpers.get_vcs_link())
@submit_utils.PARAM_SUBMIT_METHOD
@common.PARAM_USE_BUILD_CMD
@pytest.mark.parametrize(
"tokens_db",
Expand All @@ -684,6 +693,7 @@ def test_bundle_minting_and_burning_witnesses(
multisig_script_policyid: tp.Tuple[pl.Path, str],
tokens_db: tp.Tuple[int, int, int],
use_build_cmd: bool,
submit_method: str,
):
"""Test minting and burning multiple different tokens that are in single bundle.

Expand Down Expand Up @@ -727,6 +737,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
cluster_obj=cluster,
new_tokens=tokens_to_mint,
temp_template=f"{temp_template}_mint",
submit_method=submit_method,
use_build_cmd=use_build_cmd,
)

Expand All @@ -740,7 +751,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
try:
# Disable logging of "Not enough funds to make the transaction"
logging.disable(logging.ERROR)
with pytest.raises(clusterlib.CLIError) as excinfo:
with pytest.raises((clusterlib.CLIError, submit_api.SubmitApiError)) as excinfo:
_mint_tokens()
err_msg = str(excinfo.value)
assert (
Expand Down Expand Up @@ -778,6 +789,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
cluster_obj=cluster,
new_tokens=tokens_to_burn,
temp_template=f"{temp_template}_burn",
submit_method=submit_method,
use_build_cmd=use_build_cmd,
)

Expand All @@ -802,6 +814,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
dbsync_utils.check_tx(cluster_obj=cluster, tx_raw_output=tx_out_burn)

@allure.link(helpers.get_vcs_link())
@submit_utils.PARAM_SUBMIT_METHOD
@common.PARAM_USE_BUILD_CMD
@pytest.mark.parametrize(
"tokens_db",
Expand All @@ -826,6 +839,7 @@ def test_bundle_minting_and_burning_sign(
simple_script_policyid: tp.Tuple[pl.Path, str],
tokens_db: tp.Tuple[int, int, int],
use_build_cmd: bool,
submit_method: str,
):
"""Test minting and burning multiple different tokens that are in single bundle.

Expand Down Expand Up @@ -870,6 +884,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
cluster_obj=cluster,
new_tokens=tokens_to_mint,
temp_template=f"{temp_template}_mint",
submit_method=submit_method,
use_build_cmd=use_build_cmd,
)

Expand All @@ -883,7 +898,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
try:
# Disable logging of "Not enough funds to make the transaction"
logging.disable(logging.ERROR)
with pytest.raises(clusterlib.CLIError) as excinfo:
with pytest.raises((clusterlib.CLIError, submit_api.SubmitApiError)) as excinfo:
_mint_tokens()
err_msg = str(excinfo.value)
assert (
Expand Down Expand Up @@ -921,6 +936,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
cluster_obj=cluster,
new_tokens=tokens_to_burn,
temp_template=f"{temp_template}_burn",
submit_method=submit_method,
use_build_cmd=use_build_cmd,
)

Expand All @@ -941,6 +957,7 @@ def _mint_tokens() -> clusterlib.TxRawOutput:
dbsync_utils.check_tx(cluster_obj=cluster, tx_raw_output=tx_out_burn)

@allure.link(helpers.get_vcs_link())
@submit_utils.PARAM_SUBMIT_METHOD
@common.PARAM_USE_BUILD_CMD
@pytest.mark.smoke
@pytest.mark.dbsync
Expand All @@ -949,6 +966,7 @@ def test_minting_and_partial_burning(
cluster: clusterlib.ClusterLib,
issuers_addrs: tp.List[clusterlib.AddressRecord],
use_build_cmd: bool,
submit_method: str,
):
"""Test minting and partial burning of tokens.

Expand Down Expand Up @@ -990,6 +1008,7 @@ def test_minting_and_partial_burning(
cluster_obj=cluster,
new_tokens=[token_mint],
temp_template=f"{temp_template}_mint",
submit_method=submit_method,
use_build_cmd=use_build_cmd,
sign_incrementally=True,
)
Expand All @@ -1006,6 +1025,7 @@ def test_minting_and_partial_burning(
cluster_obj=cluster,
new_tokens=[token_burn],
temp_template=f"{temp_template}_burn1",
submit_method=submit_method,
sign_incrementally=True,
)

Expand All @@ -1020,6 +1040,7 @@ def test_minting_and_partial_burning(
cluster_obj=cluster,
new_tokens=[final_burn],
temp_template=f"{temp_template}_burn2",
submit_method=submit_method,
use_build_cmd=use_build_cmd,
sign_incrementally=True,
)
Expand All @@ -1034,6 +1055,7 @@ def test_minting_and_partial_burning(
dbsync_utils.check_tx(cluster_obj=cluster, tx_raw_output=tx_out_burn2)

@allure.link(helpers.get_vcs_link())
@submit_utils.PARAM_SUBMIT_METHOD
@common.PARAM_USE_BUILD_CMD
@pytest.mark.smoke
@pytest.mark.dbsync
Expand All @@ -1042,6 +1064,7 @@ def test_minting_unicode_asset_name(
cluster: clusterlib.ClusterLib,
issuers_addrs: tp.List[clusterlib.AddressRecord],
use_build_cmd: bool,
submit_method: str,
):
"""Test minting and burning of token with unicode non-ascii chars in its asset name.

Expand Down Expand Up @@ -1085,6 +1108,7 @@ def test_minting_unicode_asset_name(
cluster_obj=cluster,
new_tokens=[token_mint],
temp_template=f"{temp_template}_mint",
submit_method=submit_method,
use_build_cmd=use_build_cmd,
)

Expand All @@ -1099,6 +1123,7 @@ def test_minting_unicode_asset_name(
cluster_obj=cluster,
new_tokens=[token_burn],
temp_template=f"{temp_template}_burn",
submit_method=submit_method,
use_build_cmd=use_build_cmd,
)

Expand Down
Loading