workflow_tests: fix new test action id computation (#88066)
gitea/wcs/pipeline/head This commit looks good Details

This commit is contained in:
Valentin Deniaud 2024-03-12 15:56:41 +01:00
parent 4ea852afe8
commit ad2e64880e
2 changed files with 10 additions and 1 deletions

View File

@ -129,6 +129,15 @@ def test_workflow_tests_action_not_configured(pub):
mocked_perform.assert_called_once()
def test_workflow_tests_new_action_id(pub):
wf_tests = workflow_tests.WorkflowTests()
for i in range(15):
wf_tests.add_action(workflow_tests.ButtonClick)
assert [x.id for x in wf_tests.actions] == [str(i) for i in range(1, 16)]
def test_workflow_tests_button_click(pub):
role = pub.role_class(name='test role')
role.store()

View File

@ -109,7 +109,7 @@ class WorkflowTests(XmlStorableObject):
if not self.actions:
return '1'
return str(int(max(x.id for x in self.actions)) + 1)
return str(max(int(x.id) for x in self.actions) + 1)
def add_action(self, action_class):
action = action_class(id=self.get_new_action_id())