Bug 1388365 - Return value from assert_success. r?whimboo
Return the contents of value, if it exists, after asserting the response
was successful.
assert_success can be passed a value which will assert that the response's
value matches an expected value. If you want to compare a subsection
of the response it may be convenient to for the value to be returned
after it has been asserted that the response was a success.
MozReview-Commit-ID: 1dyzQIazYEN
--- a/testing/web-platform/tests/webdriver/tests/support/asserts.py
+++ b/testing/web-platform/tests/webdriver/tests/support/asserts.py
@@ -75,16 +75,17 @@ def assert_success(response, value=None)
:param response: wdclient.Response instance.
:param value: Expected value of the response body, if any.
"""
assert response.status == 200
if value is not None:
assert response.body["value"] == value
+ return response.body.get("value")
def assert_dialog_handled(session, expected_text):
result = session.transport.send("GET",
"session/%s/alert/text" % session.session_id)
# If there were any existing dialogs prior to the creation of this
# fixture's dialog, then the "Get Alert Text" command will return
# successfully. In that case, the text must be different than that