workflow_tests: allow asserting webservice was not called (#87824)
gitea/wcs/pipeline/head This commit looks good Details

This commit is contained in:
Valentin Deniaud 2024-03-06 11:06:28 +01:00
parent 0c0807a0d4
commit 3d42d456d9
2 changed files with 10 additions and 0 deletions

View File

@ -580,6 +580,14 @@ def test_workflow_tests_webservice(pub):
testdef.run(formdef)
assert str(excinfo.value) == 'Webservice response Fake response was used 0 times (instead of 1).'
testdef.workflow_tests.actions = [
workflow_tests.AssertWebserviceCall(webservice_response_id=response.id, call_count=0),
]
with pytest.raises(WorkflowTestError) as excinfo:
testdef.run(formdef)
assert str(excinfo.value) == 'Webservice response Fake response was used 1 times (instead of 0).'
testdef.workflow_tests.actions = [
workflow_tests.AssertWebserviceCall(webservice_response_id='xxx', call_count=1),
]

View File

@ -502,6 +502,8 @@ class AssertWebserviceCall(WorkflowTestAction):
webservice_response_id = None
call_count = 1
optional_fields = ['call_count']
XML_NODES = WorkflowTestAction.XML_NODES + [
('webservice_response_id', 'str'),
('call_count', 'int'),