MCPcopy
hub / github.com/scrapy/scrapy / test_from_response_get

Method test_from_response_get

tests/test_http_request_form.py:242–261  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

240 assert req.headers["Accept-Encoding"] == b"gzip,deflate"
241
242 def test_from_response_get(self):
243 response = _buildresponse(
244 """<form action="get.php" method="GET">
245 <input type="hidden" name="test" value="val1">
246 <input type="hidden" name="test" value="val2">
247 <input type="hidden" name="test2" value="xxx">
248 </form>""",
249 url="http://www.example.com/this/list.html",
250 )
251 r1 = self.request_class.from_response(
252 response, formdata={"one": ["two", "three"], "six": "seven"}
253 )
254 assert r1.method == "GET"
255 assert urlparse_cached(r1).hostname == "www.example.com"
256 assert urlparse_cached(r1).path == "/this/get.php"
257 fs = _qs(r1)
258 assert set(fs[b"test"]) == {b"val1", b"val2"}
259 assert set(fs[b"one"]) == {b"two", b"three"}
260 assert fs[b"test2"] == [b"xxx"]
261 assert fs[b"six"] == [b"seven"]
262
263 def test_from_response_override_params(self):
264 response = _buildresponse(

Callers

nothing calls this directly

Calls 4

urlparse_cachedFunction · 0.90
_buildresponseFunction · 0.85
_qsFunction · 0.85
from_responseMethod · 0.80

Tested by

no test coverage detected