From 29bd3722d2b6ad79fcce140da05a60bcf3bd550f Mon Sep 17 00:00:00 2001
From: Andreas Tolfsen <ato@sny.no>
Date: Tue, 1 Aug 2017 18:21:59 +0100
Subject: [PATCH] Bug 1381876 - Allow assert_success to be used without an
 expected value. r=automatedtester

It happens that we receive responses that do not have a body value.
We want to be able to use assert_success with these as well.

MozReview-Commit-ID: B1f0Hn406Nj

--HG--
extra : rebase_source : 6f47e4bd8a72fecf365a6e06771effb1f8e055a5
---
 .../tests/webdriver/tests/support/asserts.py         | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/testing/web-platform/tests/webdriver/tests/support/asserts.py b/testing/web-platform/tests/webdriver/tests/support/asserts.py
index a90934078fb48..0d15964c9bba0 100644
--- a/testing/web-platform/tests/webdriver/tests/support/asserts.py
+++ b/testing/web-platform/tests/webdriver/tests/support/asserts.py
@@ -68,16 +68,18 @@ def assert_error(response, error_code):
     assert isinstance(response.body["value"]["message"], basestring)
     assert isinstance(response.body["value"]["stacktrace"], basestring)
 
-def assert_success(response, value):
+def assert_success(response, value=None):
     """Verify that the provided wdclient.Response instance described a valid
     error response as defined by `dfn-send-an-error` and the provided error
     code.
-    :param response: wdclient.Response instance
-    :param value: expected value of the response body
-    """
 
+    :param response: wdclient.Response instance.
+    :param value: Expected value of the response body, if any.
+
+    """
     assert response.status == 200
-    assert response.body["value"] == value
+    if value is not None:
+        assert response.body["value"] == value
 
 def assert_dialog_handled(session, expected_text):
     result = session.transport.send("GET",
-- 
GitLab