Closed Bug 1469601 Opened 2 years ago Closed Last year

[wdspec] Add tests for POST commands which make use of a Null body

Categories

(Testing :: geckodriver, enhancement, P2)

enhancement

Tracking

(firefox63 fixed)

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

Attachments

(2 files, 3 obsolete files)

This request comes from a discussion on bug 1448792.

For all of the POST commands we should add tests which check that passing in no body will cause an InvalidArgument error to be raised.
Priority: -- → P3
Those tests make sure that an "invalid argument" error is raised
if the body doesn't contain any data.
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Priority: P3 → P2
Attachment #8999990 - Flags: review?(ato)
Attachment #8999992 - Flags: review?(ato)
Attachment #8999992 - Flags: review?(ato) → review+
Comment on attachment 8999990 [details] [diff] [review]
[wdspec] Add tests for POST commands which make use of a Null body

Review of attachment 8999990 [details] [diff] [review]:
-----------------------------------------------------------------

::: testing/web-platform/tests/webdriver/tests/add_cookie/add.py
@@ +15,5 @@
> +
> +    response = session.transport.send(
> +        "POST", "session/{session_id}/cookie".format(**vars(session)),
> +        None, allow_empty_body=True)
> +    assert_error(response, "invalid argument")

For testing invalid HTTP requests we have the ‘http’ fixture:
https://searchfox.org/mozilla-central/rev/2466b82b729765fb0a3ab62f812c1a96a7362478/testing/web-platform/tests/webdriver/tests/support/fixtures.py#177-178

It is defined here:
https://searchfox.org/mozilla-central/source/testing/web-platform/tests/webdriver/tests/support/http_request.py#5

And used like this:

> with http.post("/session/{session_id}/cookie".format(**vars(session)), None) as request:
>     pass

… except the ‘post’ method is not implemented yet.
Attachment #8999990 - Flags: review?(ato) → review-
Attachment #8999992 - Attachment is obsolete: true
Those tests make sure that an "invalid argument" error is raised
if the body doesn't contain any data.
Attachment #8999990 - Attachment is obsolete: true
Comment on attachment 9001113 [details] [diff] [review]
[webdriver] Fix Add Cookie command to raise an "invalid argument" error if parameters are null

I accidentally pushed this commit again which removed your review status. Sorry.
Attachment #9001113 - Flags: review?(ato)
Attachment #9001121 - Flags: review?(ato)
Attachment #9001113 - Flags: review?(ato) → review+
Attachment #9001121 - Flags: review?(ato) → review+
The try build shows a failure for:

EST-UNEXPECTED-FAIL | /webdriver/tests/find_element_from_element/find.py | test_null_parameter_value - BadStatusLine: ''

Problem is that I accidentally changed the shared `find_element` method, and added a `/` at the beginning of the path.

I will push an update before landing the patch.
Those tests make sure that an "invalid argument" error is raised
if the body doesn't contain any data.
Attachment #9001121 - Attachment is obsolete: true
Comment on attachment 9001263 [details] [diff] [review]
[wdspec] Add tests for POST commands which make use of a Null body

Taking over r+ from ato for the updated failure.
Attachment #9001263 - Flags: review+
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/052b350b861b
[webdriver] Fix Add Cookie command to raise an "invalid argument" error if parameters are null. r=ato
https://hg.mozilla.org/integration/mozilla-inbound/rev/7915b80eca09
[wdspec] Add tests for POST commands which make use of a Null body. r=ato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/12507 for changes under testing/web-platform/tests
https://hg.mozilla.org/mozilla-central/rev/052b350b861b
https://hg.mozilla.org/mozilla-central/rev/7915b80eca09
Status: ASSIGNED → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.