Skip to content

Commit 9e45286

Browse files
This PR refactors test_conway.py align with the new build Method
1 parent 77411ff commit 9e45286

File tree

1 file changed

+21
-33
lines changed

1 file changed

+21
-33
lines changed

cardano_node_tests/tests/tests_conway/test_conway.py

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _run_test_action_unreg_deposit_addr(
7373
cluster: clusterlib.ClusterLib,
7474
temp_template: str,
7575
pool_user: clusterlib.PoolUser,
76-
use_build_cmd: bool,
76+
build_method: str,
7777
submit_method: str = submit_utils.SubmitMethods.CLI,
7878
):
7979
"""Run the actual scenario of the 'test_action_unreg_deposit_addr*' tests."""
@@ -104,62 +104,50 @@ def _run_test_action_unreg_deposit_addr(
104104
name_template=f"{temp_template}_action",
105105
src_address=pool_user.payment.address,
106106
submit_method=submit_method,
107-
use_build_cmd=use_build_cmd,
107+
build_method=build_method,
108108
tx_files=tx_files_action,
109109
)
110110
err_str = str(excinfo.value)
111-
if use_build_cmd:
111+
if build_method in (
112+
clusterlib_utils.BuildMethods.BUILD,
113+
clusterlib_utils.BuildMethods.BUILD_EST,
114+
):
112115
assert (
113116
"Stake credential specified in the proposal is not registered on-chain" in err_str
114-
or "ProposalReturnAccountDoesNotExist" in err_str # In node <= 10.1.4
117+
or "ProposalReturnAccountDoesNotExist" in err_str # For node <= 10.1.4
115118
), err_str
116-
else:
119+
elif build_method == clusterlib_utils.BuildMethods.BUILD_RAW:
117120
assert "ProposalReturnAccountDoesNotExist" in err_str, err_str
121+
else:
122+
msg = f"Unsupported build method: {build_method}"
123+
raise ValueError(msg)
118124

119125
@allure.link(helpers.get_vcs_link())
126+
@common.PARAM_BUILD_METHOD_NO_EST
120127
@submit_utils.PARAM_SUBMIT_METHOD
121128
@pytest.mark.smoke
122-
def test_action_submit_unreg_deposit_addr(
129+
def test_action_unreg_deposit_addr(
123130
self,
124131
cluster: clusterlib.ClusterLib,
125132
pool_user: clusterlib.PoolUser,
133+
build_method: str,
126134
submit_method: str,
127135
):
128-
"""Test submitting an action with an unregistered deposit return address.
136+
"""Test creating or submitting an action with an unregistered deposit return address.
129137
130138
Expect failure.
131139
132-
The transaction is built using `transaction build-raw`, which does not check
133-
deposit return address registration. The transaction is expected to fail on submission.
140+
* `transaction build` - fails at build time because the deposit return stake credential
141+
is not registered.
142+
* `transaction build-estimate` - behaves like `build`, fails at build time.
143+
* `transaction build-raw` - does not check during build; transaction is expected
144+
to fail on submission.
134145
"""
135146
temp_template = common.get_test_id(cluster)
136147
return self._run_test_action_unreg_deposit_addr(
137148
cluster=cluster,
138149
temp_template=temp_template,
139150
pool_user=pool_user,
140-
use_build_cmd=False,
151+
build_method=build_method,
141152
submit_method=submit_method,
142153
)
143-
144-
@allure.link(helpers.get_vcs_link())
145-
@common.SKIPIF_BUILD_UNUSABLE
146-
@pytest.mark.smoke
147-
def test_action_build_unreg_deposit_addr(
148-
self,
149-
cluster: clusterlib.ClusterLib,
150-
pool_user: clusterlib.PoolUser,
151-
):
152-
"""Test building a Tx when deposit return address is unregistered.
153-
154-
Expect failure.
155-
156-
The `transaction build` command checks deposit return address registration
157-
during Tx building, causing the build to fail.
158-
"""
159-
temp_template = common.get_test_id(cluster)
160-
return self._run_test_action_unreg_deposit_addr(
161-
cluster=cluster,
162-
temp_template=temp_template,
163-
pool_user=pool_user,
164-
use_build_cmd=True,
165-
)

0 commit comments

Comments
 (0)