Bug 218927

Summary: [webkitcorepy] Support mocking request network calls.
Product: WebKit Reporter: Jonathan Bedard <jbedard>
Component: Tools / TestsAssignee: Jonathan Bedard <jbedard>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=218827
Attachments:
Description Flags
Patch
none
Patch none

Description Jonathan Bedard 2020-11-13 16:16:50 PST
Similar to the utilities provided for subprocess, we should provide utilities to mock request's network calls.
Comment 1 Radar WebKit Bug Importer 2020-11-13 16:23:58 PST
<rdar://problem/71389720>
Comment 2 Jonathan Bedard 2020-11-13 20:38:19 PST
Created attachment 414122 [details]
Patch
Comment 3 Aakash Jain 2020-11-16 15:24:59 PST
Comment on attachment 414122 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=414122&action=review

rs=me.

> Tools/ChangeLog:11
> +        * Scripts/libraries/webkitcorepy/webkitcorepy/mocks/requests.py: Moved to requests_.

why?

> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/tests/mocks/requests_unittest.py:29
> +class MockRequests(unittest.TestCase):

can we add more unit-tests here, maybe for headers, and also request_.Response class (various status codes).
Comment 4 Jonathan Bedard 2020-11-16 15:51:49 PST
Comment on attachment 414122 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=414122&action=review

>> Tools/ChangeLog:11
>> +        * Scripts/libraries/webkitcorepy/webkitcorepy/mocks/requests.py: Moved to requests_.
> 
> why?

Otherwise Python 2 gets very confused when trying to import requests from requests.py.
Comment 5 Jonathan Bedard 2020-11-17 12:14:37 PST
Created attachment 414367 [details]
Patch
Comment 6 EWS 2020-11-17 13:02:14 PST
Committed r269919: <https://trac.webkit.org/changeset/269919>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 414367 [details].