jenkins-bot has submitted this change and it was merged.

Change subject: Fix requests redirect test
......................................................................


Fix requests redirect test

Bug: T101601
Change-Id: I79b378bc40aaad8d7a9de0fc4b9924fd6033489f
---
M tests/http_tests.py
1 file changed, 4 insertions(+), 9 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, but someone else must approve
  XZise: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/http_tests.py b/tests/http_tests.py
index 9a7340b..3f08693 100644
--- a/tests/http_tests.py
+++ b/tests/http_tests.py
@@ -171,22 +171,17 @@
                           uri='invalid://url')
 
     def test_follow_redirects(self):
-        """Test follow 301 redirects after an exception works correctly."""
-        # It doesnt matter what exception is raised here, provided it
-        # occurs within the requests request method.
-        self.assertRaises(requests.exceptions.InvalidSchema,
-                          http.fetch,
-                          uri='invalid://url')
-
+        """Test follow 301 redirects correctly."""
         # The following will redirect from ' ' -> '_', and maybe to https://
         r = http.fetch(uri='http://en.wikipedia.org/wiki/Main%20Page')
         self.assertEqual(r.status, 200)
+        self.assertIsNotNone(r.data.history)
         self.assertIn('//en.wikipedia.org/wiki/Main_Page',
-                      
http.session.redirect_cache.get('http://en.wikipedia.org/wiki/Main%20Page'))
+                      r.data.url)
 
         r = http.fetch(uri='http://www.gandi.eu')
         self.assertEqual(r.status, 200)
-        
self.assertEqual(http.session.redirect_cache.get('http://www.gandi.eu/'),
+        self.assertEqual(r.data.url,
                          'http://www.gandi.net')
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/217846
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I79b378bc40aaad8d7a9de0fc4b9924fd6033489f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to