Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Add tests for shell command with and without --no-redirect

Paul Tremberth7e54de24550d
diff --git a/tests/test_command_shell.py b/tests/test_command_shell.py
index 7bb7439d6..ee6e8ad8e 100644
--- a/tests/test_command_shell.py
+++ b/tests/test_command_shell.py
@@ -49,6 +49,16 @@ class ShellTest(ProcessTest, SiteTest, unittest.TestCase):
_, out, _ = yield self.execute([self.url('/redirect'), '-c', 'response.url'])
assert out.strip().endswith(b'/redirected')
+ @defer.inlineCallbacks
+ def test_redirect_follow_302(self):
+ _, out, _ = yield self.execute([self.url('/redirect-no-meta-refresh'), '-c', 'response.status'])
+ assert out.strip().endswith(b'200')
+
+ @defer.inlineCallbacks
+ def test_redirect_not_follow_302(self):
+ _, out, _ = yield self.execute(['--no-redirect', self.url('/redirect-no-meta-refresh'), '-c', 'response.status'])
+ assert out.strip().endswith(b'302')
+
@defer.inlineCallbacks
def test_request_replace(self):
url = self.url('/text')