Bug 1388365 - Return value from assert_success. r?whimboo draft
authorAndreas Tolfsen <ato@sny.no>
Tue, 08 Aug 2017 15:37:15 +0100
changeset 642718 61311750a3609096a7bdce45cf1c9a5992fb283e
parent 642717 6fc2ca2f0ca5327d075283458c9ef18e22e23e35
child 642719 e5aa430e0b46e00a1044aa1d592e0084252fb064
push id72846
push userbmo:ato@sny.no
push dateTue, 08 Aug 2017 17:43:46 +0000
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