Skip to content
Snippets Groups Projects
Commit 29bd3722 authored by Andreas Tolfsen's avatar Andreas Tolfsen
Browse files

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
parent e6fdbe4c
No related branches found
No related tags found
No related merge requests found
...@@ -68,16 +68,18 @@ def assert_error(response, error_code): ...@@ -68,16 +68,18 @@ def assert_error(response, error_code):
assert isinstance(response.body["value"]["message"], basestring) assert isinstance(response.body["value"]["message"], basestring)
assert isinstance(response.body["value"]["stacktrace"], 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 """Verify that the provided wdclient.Response instance described a valid
error response as defined by `dfn-send-an-error` and the provided error error response as defined by `dfn-send-an-error` and the provided error
code. 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.status == 200
assert response.body["value"] == value if value is not None:
assert response.body["value"] == value
def assert_dialog_handled(session, expected_text): def assert_dialog_handled(session, expected_text):
result = session.transport.send("GET", result = session.transport.send("GET",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment