XZise has submitted this change and it was merged.
Change subject: site_tests.py: create test for deprecated functions ......................................................................
site_tests.py: create test for deprecated functions
Put tests of deprecated functions in one specific test case.
Change-Id: Ibdb22275365ed17b227d4c379f2863a6fadadbf5 --- M tests/site_tests.py 1 file changed, 28 insertions(+), 4 deletions(-)
Approvals: XZise: Looks good to me, approved
diff --git a/tests/site_tests.py b/tests/site_tests.py index b2fb360..232fbd2 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -26,6 +26,34 @@ unicode = str
+class TestSiteObjectDeprecatedFunctions(DefaultSiteTestCase): + + """Test cases for Site deprecated methods.""" + + cached = True + + def test_live_version(self): + """Test live_version.""" + mysite = self.get_site() + ver = mysite.live_version() + self.assertIsInstance(ver, tuple) + self.assertTrue(all(isinstance(ver[i], int) for i in (0, 1))) + self.assertIsInstance(ver[2], basestring) + + def test_token(self): + """Test ability to get page tokens.""" + mysite = self.get_site() + mainpage = self.get_mainpage() + ttype = "edit" + try: + token = mysite.tokens[ttype] + except KeyError: + raise unittest.SkipTest( + "Testing '%s' token not possible with user on %s" + % (ttype, self.site)) + self.assertEqual(token, mysite.token(mainpage, ttype)) + + class TestSiteObject(DefaultSiteTestCase):
"""Test cases for Site methods.""" @@ -1103,10 +1131,6 @@ self.assertGreater(mysite.siteinfo['maxuploadsize'], 0) self.assertIn(mysite.case(), ["first-letter", "case-sensitive"]) self.assertEqual(re.findall("$1", mysite.siteinfo['articlepath']), ["$1"]) - ver = mysite.live_version() - self.assertIsInstance(ver, tuple) - self.assertTrue(all(isinstance(ver[i], int) for i in (0, 1))) - self.assertIsInstance(ver[2], basestring)
def entered_loop(iterable): for iterable_item in iterable:
pywikibot-commits@lists.wikimedia.org