Skip to content

Commit c84b57a

Browse files
Add test
1 parent 66a7ea8 commit c84b57a

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

tests/test_codes.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,30 @@ def condition(params):
136136
model.input_parameters = {"use_this_code": False}
137137
assert not model.get_model("test").is_active
138138
assert panel.code_widgets["test"].layout.display == "none"
139+
140+
141+
def test_filter_codes_for_user(app: Wizard, aiida_computer_ssh, aiida_code_installed):
142+
unconfigured_computer = aiida_computer_ssh(
143+
label="unconfigured_computer",
144+
configure=False,
145+
)
146+
new_code = aiida_code_installed(
147+
default_calc_job_plugin="quantumespresso.pw",
148+
computer=unconfigured_computer,
149+
).store()
150+
151+
global_model = app.submit_model.get_model("global")
152+
153+
# In general, we filter out unconfigured codes so the user can't submit with them
154+
app.submit_model.refresh_codes(filter_codes_for_user=True)
155+
assert new_code.uuid not in [
156+
code_uuid
157+
for _, code_uuid in global_model.get_model("quantumespresso__pw").options
158+
]
159+
160+
# We allow for these codes when loading from a process, since the user can no longer submit
161+
app.submit_model.refresh_codes(filter_codes_for_user=False)
162+
assert new_code.uuid in [
163+
code_uuid
164+
for _, code_uuid in global_model.get_model("quantumespresso__pw").options
165+
]

0 commit comments

Comments
 (0)