jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/661724 )
Change subject: [cleanup] Remove deprecated Site.getToken() and Site.case
......................................................................
[cleanup] Remove deprecated Site.getToken() and Site.case
update tests accordingly
Change-Id: I0a2c762f68860c4ced0432dee16cb6025c5931bb
---
M pywikibot/site/_apisite.py
M tests/site_tests.py
M tests/token_tests.py
3 files changed, 1 insertion(+), 50 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 0767a30..1879c5d 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -970,14 +970,6 @@
"""Site information dict."""
return self._siteinfo
- @deprecated('siteinfo or Namespace instance', since='20150830',
- future_warning=True)
- def case(self): # pragma: no cover
- """Return this site's capitalization rule."""
- # This is the global setting via $wgCapitalLinks, it is used whenever
- # the namespaces don't propagate the namespace specific value.
- return self.siteinfo['case']
-
def dbName(self):
"""Return this site's internal id."""
return self.siteinfo['wikiid']
@@ -1842,23 +1834,6 @@
@deprecated("the 'tokens' property", since='20150218', future_warning=True)
@remove_last_args(['sysop'])
- def getToken(self, getalways=True, getagain=False): # pragma: no cover
- """DEPRECATED: Get edit token."""
- if self.username() != self.user():
- raise ValueError('The token for {0} was requested but only the '
- 'token for {1} can be retrieved.'.format(
- self.username(), self.user()))
- if not getalways:
- raise ValueError('In pywikibot/core getToken does not support the '
- 'getalways parameter.')
- token = self.validate_tokens(['edit'])[0]
- if getagain and token in self.tokens:
- # invalidate token
- del self.tokens._tokens[self.user()][token]
- return self.tokens[token]
-
- @deprecated("the 'tokens' property", since='20150218', future_warning=True)
- @remove_last_args(['sysop'])
def getPatrolToken(self): # pragma: no cover
"""DEPRECATED: Get patrol token."""
if self.username() != self.user():
diff --git a/tests/site_tests.py b/tests/site_tests.py
index c00f5a3..a08cdad 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -42,12 +42,6 @@
cached = True
- def test_capitalization(self):
- """Test that the case method is mirroring the siteinfo."""
- self.assertEqual(self.site.case(), self.site.siteinfo['case'])
- self.assertOneDeprecationParts('pywikibot.site.APISite.case',
- 'siteinfo or Namespace instance')
-
def test_siteinfo_normal_call(self):
"""Test calling the Siteinfo without setting dump."""
old = self.site.siteinfo('general')
diff --git a/tests/token_tests.py b/tests/token_tests.py
index 80e4816..56181c4 100644
--- a/tests/token_tests.py
+++ b/tests/token_tests.py
@@ -1,6 +1,6 @@
"""Tests for tokens."""
#
-# (C) Pywikibot team, 2015-2020
+# (C) Pywikibot team, 2015-2021
#
# Distributed under the terms of the MIT license.
#
@@ -184,24 +184,6 @@
self.assertTrue(raised, msg='pywikibot.Error not raised')
-class TestDeprecatedEditTokenFunctions(TokenTestBase,
- DefaultSiteTestCase,
- DeprecationTestCase):
-
- """Test cases for Site edit token deprecated methods."""
-
- cached = True
- user = True
- token_type = 'edit'
-
- def test_get_token(self):
- """Test ability to get page tokens using site.getToken."""
- self.mysite = self.site
- self.assertEqual(self.mysite.getToken(), self.mysite.tokens['edit'])
- self.assertOneDeprecationParts('pywikibot.site.APISite.getToken',
- "the 'tokens' property")
-
-
class TestDeprecatedPatrolToken(DefaultSiteTestCase, DeprecationTestCase):
"""Test cases for Site patrol token deprecated methods."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/661724
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I0a2c762f68860c4ced0432dee16cb6025c5931bb
Gerrit-Change-Number: 661724
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits