From 72485128cb29751b3b03f6a04e73e4cc50912910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gra=C3=B1a?= Date: Thu, 19 Apr 2012 16:58:01 -0300 Subject: [PATCH] Add a test case to cover input elements as not direct child of form element. #111 #121 --- scrapy/tests/test_http_request.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scrapy/tests/test_http_request.py b/scrapy/tests/test_http_request.py index 025d49b28..8cc091446 100644 --- a/scrapy/tests/test_http_request.py +++ b/scrapy/tests/test_http_request.py @@ -553,6 +553,28 @@ class FormRequestTest(RequestTest): fs = _qs(req) self.assertEqual(fs, {'i1': ['i1v'], 'i2': [''], 'i3': ['']}) + def test_from_response_descendants(self): + res = _buildresponse( + '''
+
+
+ + +
+ + + + +
+ +
''') + req = self.request_class.from_response(res) + fs = _qs(req) + self.assertEqual(set(fs), set(['h2', 'i2', 'i1', 'i3', 'h1', 'i5', 'i4'])) + + def _buildresponse(body, **kwargs): kwargs.setdefault('body', body) kwargs.setdefault('url', 'http://example.com')