jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] React correctly to dynamic tokens ......................................................................
[FIX] React correctly to dynamic tokens
With d4e6e60c the tokens are loaded dynamically and that means that certain tokens are now not validated anymore. It also removes one usage of action+ prefix.
Change-Id: If95709f49d7d1da68e37ee89857e331bb6193ad8 --- M pywikibot/site.py M tests/site_tests.py 2 files changed, 11 insertions(+), 6 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py index fdecbe0..457a917 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -2713,7 +2713,7 @@ else: if _version < MediaWikiVersion('1.24wmf19'): if all is not False: - types_wiki = self._paraminfo.parameter('action+tokens', + types_wiki = self._paraminfo.parameter('tokens', 'type')['type'] types.extend(types_wiki) req = api.Request(site=self, action='tokens', diff --git a/tests/site_tests.py b/tests/site_tests.py index 762f91f..322f1ef 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -1469,11 +1469,16 @@ try: token = self.mysite.tokens[ttype] except pywikibot.Error as error_msg: - self.assertRegex( - unicode(error_msg), - "Action '[a-z]+' is not allowed for user .* on .* wiki.") - # test __contains__ - self.assertNotIn(tokentype[0], self.mysite.tokens) + if tokentype: + self.assertRegex( + unicode(error_msg), + "Action '[a-z]+' is not allowed for user .* on .* wiki.") + # test __contains__ + self.assertNotIn(tokentype[0], self.mysite.tokens) + else: + self.assertRegex( + unicode(error_msg), + "Requested token '[a-z]+' is invalid on .* wiki.") else: self.assertIsInstance(token, basestring) self.assertEqual(token, self.mysite.tokens[ttype])
pywikibot-commits@lists.wikimedia.org