workflow_tests: ignore html in alert message (#90038)
gitea/wcs/pipeline/head This commit looks good
Details
gitea/wcs/pipeline/head This commit looks good
Details
This commit is contained in:
parent
d8cb5e4737
commit
2927168c83
|
@ -895,17 +895,17 @@ def test_workflow_tests_alert(pub):
|
|||
|
||||
testdef = TestDef.create_from_formdata(formdef, formdata)
|
||||
testdef.workflow_tests.actions = [
|
||||
workflow_tests.AssertAlert(message='Hello 42'),
|
||||
workflow_tests.AssertAlert(message='Héllo 42 abc'),
|
||||
]
|
||||
|
||||
with pytest.raises(WorkflowTestError) as excinfo:
|
||||
testdef.run(formdef)
|
||||
assert str(excinfo.value) == 'No alert matching message.'
|
||||
assert 'Displayed alerts: None' in excinfo.value.details
|
||||
assert 'Expected alert: Hello 42' in excinfo.value.details
|
||||
assert 'Expected alert: Héllo 42 abc' in excinfo.value.details
|
||||
|
||||
alert = new_status.add_action('displaymsg')
|
||||
alert.message = 'Hello {{ 41|add:1 }}'
|
||||
alert.message = 'Héllo <strong>{{ 41|add:1 }}</strong> abc'
|
||||
workflow.store()
|
||||
formdef.refresh_from_storage()
|
||||
|
||||
|
@ -918,7 +918,7 @@ def test_workflow_tests_alert(pub):
|
|||
with pytest.raises(WorkflowTestError) as excinfo:
|
||||
testdef.run(formdef)
|
||||
assert str(excinfo.value) == 'No alert matching message.'
|
||||
assert 'Displayed alerts: <p>Hello 42</p>' in excinfo.value.details
|
||||
assert 'Displayed alerts: Héllo 42 abc' in excinfo.value.details
|
||||
assert 'Expected alert: Hello 43' in excinfo.value.details
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import uuid
|
|||
|
||||
import freezegun
|
||||
from django.utils.timezone import localtime
|
||||
from pyquery import PyQuery as pq
|
||||
from quixote import get_publisher, get_session
|
||||
from quixote.html import htmltext
|
||||
|
||||
|
@ -938,7 +939,7 @@ class AssertAlert(WorkflowTestAction):
|
|||
return misc.ellipsize(self.message)
|
||||
|
||||
def perform(self, formdata):
|
||||
messages = formdata.get_workflow_messages()
|
||||
messages = [pq(x).text() for x in formdata.get_workflow_messages()]
|
||||
|
||||
for message in messages:
|
||||
if self.message in message:
|
||||
|
|
Loading…
Reference in New Issue