Skip to content

Commit 5082bda

Browse files
This PR refactors test_constitution.py align with the new build Method
1 parent 4413e22 commit 5082bda

File tree

1 file changed

+33
-21
lines changed

1 file changed

+33
-21
lines changed

cardano_node_tests/tests/tests_conway/test_conway.py

Lines changed: 33 additions & 21 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-
build_method: str,
76+
use_build_cmd: bool,
7777
submit_method: str = submit_utils.SubmitMethods.CLI,
7878
):
7979
"""Run the actual scenario of the 'test_action_unreg_deposit_addr*' tests."""
@@ -104,50 +104,62 @@ 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-
build_method=build_method,
107+
use_build_cmd=use_build_cmd,
108108
tx_files=tx_files_action,
109109
)
110110
err_str = str(excinfo.value)
111-
if build_method in (
112-
clusterlib_utils.BuildMethods.BUILD,
113-
clusterlib_utils.BuildMethods.BUILD_EST,
114-
):
111+
if use_build_cmd:
115112
assert (
116113
"Stake credential specified in the proposal is not registered on-chain" in err_str
117-
or "ProposalReturnAccountDoesNotExist" in err_str # For node <= 10.1.4
114+
or "ProposalReturnAccountDoesNotExist" in err_str # In node <= 10.1.4
118115
), err_str
119-
elif build_method == clusterlib_utils.BuildMethods.BUILD_RAW:
120-
assert "ProposalReturnAccountDoesNotExist" in err_str, err_str
121116
else:
122-
msg = f"Unsupported build method: {build_method}"
123-
raise ValueError(msg)
117+
assert "ProposalReturnAccountDoesNotExist" in err_str, err_str
124118

125119
@allure.link(helpers.get_vcs_link())
126-
@common.PARAM_BUILD_METHOD_NO_EST
127120
@submit_utils.PARAM_SUBMIT_METHOD
128121
@pytest.mark.smoke
129-
def test_action_unreg_deposit_addr(
122+
def test_action_submit_unreg_deposit_addr(
130123
self,
131124
cluster: clusterlib.ClusterLib,
132125
pool_user: clusterlib.PoolUser,
133-
build_method: str,
134126
submit_method: str,
135127
):
136-
"""Test creating or submitting an action with an unregistered deposit return address.
128+
"""Test submitting an action with an unregistered deposit return address.
137129
138130
Expect failure.
139131
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.
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.
145134
"""
146135
temp_template = common.get_test_id(cluster)
147136
return self._run_test_action_unreg_deposit_addr(
148137
cluster=cluster,
149138
temp_template=temp_template,
150139
pool_user=pool_user,
151-
build_method=build_method,
140+
use_build_cmd=False,
152141
submit_method=submit_method,
153142
)
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)