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

Change subject: Add tests for Category redirects
......................................................................


Add tests for Category redirects

Change-Id: I3e7ed4f8ece80f81d533982983da46d175e5d2f1
---
M tests/category_tests.py
1 file changed, 17 insertions(+), 0 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/category_tests.py b/tests/category_tests.py
index 9e57069..8923884 100644
--- a/tests/category_tests.py
+++ b/tests/category_tests.py
@@ -132,6 +132,23 @@
         articles_total = list(cat.articles(total=2))
         self.assertEqual(len(articles_total), 2)
 
+    def test_redirects(self):
+        """Test the redirects method."""
+        site = self.get_site()
+        cat1 = pywikibot.Category(site, 'Category:Fonts')
+        cat2 = pywikibot.Category(site, 'Category:Typefaces')
+
+        self.assertTrue(cat1.isCategoryRedirect())
+        self.assertFalse(cat2.isCategoryRedirect())
+
+        # The correct target category if fetched.
+        tgt = cat1.getCategoryRedirectTarget()
+        self.assertEqual(tgt, cat2)
+
+        # Raise exception if target is fetched for non Category redirects.
+        self.assertRaises(pywikibot.IsNotRedirectPage,
+                          cat2.getCategoryRedirectTarget)
+
 
 class TestCategoryDryObject(TestCase):
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3e7ed4f8ece80f81d533982983da46d175e5d2f1
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to