jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1041867?usp=email )
Change subject: [tests] set maxDiff to None in TestProtectionBot.test_summary()
......................................................................
[tests] set maxDiff to None in TestProtectionBot.test_summary()
This does not solve the problem but shows the difference.
Bug: T367259
Change-Id: Ie6f61bd5134406c43a8d7e123e59d927d62e44f6
---
M tests/protectbot_tests.py
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/protectbot_tests.py b/tests/protectbot_tests.py
index ebf16ca..c8339c7 100755
--- a/tests/protectbot_tests.py
+++ b/tests/protectbot_tests.py
@@ -52,6 +52,8 @@
rev[1].comment,
'Removed protection from "[[User:Sn1per/ProtectTest2]]": Bot: '
'Unprotecting all pages from category Pywikibot Protect Test')
+
+ self.maxDiff = None
self.assertEqual(
rev[0].comment,
'Protected "[[User:Sn1per/ProtectTest2]]": Bot: '
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1041867?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie6f61bd5134406c43a8d7e123e59d927d62e44f6
Gerrit-Change-Number: 1041867
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1041651?usp=email )
Change subject: [fix] pass None instead or an empty string for expiry argument
......................................................................
[fix] pass None instead or an empty string for expiry argument
Bug: T367176
Change-Id: I12617d6d709cc37a8d5e9465f0422a26117f25b1
---
M pywikibot/page/_basepage.py
M pywikibot/site/_apisite.py
2 files changed, 17 insertions(+), 11 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 51d8438..9890e8d 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -2148,8 +2148,9 @@
protections dictionary.
Expiry of protections can be set via *kwargs*, see
- :meth:`Site.protect()<pywikibot.site._apisite.APISite.protect>` for
- details. By default there is no expiry for the protection types.
+ :meth:`Site.protect()<pywikibot.site._apisite.APISite.protect>`
+ for details. By default there is no expiry for the protection
+ types.
.. seealso::
- :meth:`Site.protect()
@@ -2162,10 +2163,10 @@
Defaults to protections is None, which means unprotect all
protection types.
- Example: ``{'move': 'sysop', 'edit': 'autoconfirmed'}``
+ Example: :code:`{'move': 'sysop', 'edit': 'autoconfirmed'}`
- :param reason: Reason for the action, default is None and will set an
- empty string.
+ :param reason: Reason for the action, default is None and will
+ set an empty string.
"""
protections = protections or {} # protections is converted to {}
reason = reason or '' # None is converted to ''
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 417fb99..5ca39e4 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -2760,9 +2760,10 @@
"""(Un)protect a wiki page. Requires *protect* right.
.. seealso::
- - :api:`Protect`
+ - :meth:`page.BasePage.protect`
- :meth:`protection_types`
- :meth:`protection_levels`
+ - :api:`Protect`
:param protections: A dict mapping type of protection to
protection level of that type. Refer :meth:`protection_types`
@@ -2781,11 +2782,15 @@
protections_list = [ptype + '=' + level
for ptype, level in protections.items()
if level is not None]
- parameters = merge_unique_dicts(kwargs, action='protect', title=page,
- token=token,
- protections=protections_list,
- reason=reason,
- expiry=expiry)
+ parameters = merge_unique_dicts(
+ kwargs,
+ action='protect',
+ title=page,
+ token=token,
+ protections=protections_list,
+ reason=reason,
+ expiry=expiry or None, # pass None instead of empty str
+ )
req = self.simple_request(**parameters)
try:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1041651?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I12617d6d709cc37a8d5e9465f0422a26117f25b1
Gerrit-Change-Number: 1041651
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1041631?usp=email )
Change subject: [tests] skip test_titleblacklist when running test as sysop
......................................................................
[tests] skip test_titleblacklist when running test as sysop
Bug: T367166
Change-Id: Iafcc1646f3c5080c5919f4814d9658508307f82f
---
M tests/edit_failure_tests.py
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/edit_failure_tests.py b/tests/edit_failure_tests.py
index ce984cb..a9eab69 100755
--- a/tests/edit_failure_tests.py
+++ b/tests/edit_failure_tests.py
@@ -59,6 +59,10 @@
def test_titleblacklist(self):
"""Test that title blacklist raise the appropriate exception."""
+ user = pywikibot.User(self.site, self.site.user())
+ if 'sysop' in user.groups():
+ self.skipTest(f'{user} is member of the sysop group')
+
page = pywikibot.Page(self.site, 'User:UpsandDowns1234/Blacklisttest')
with self.assertRaises(TitleblacklistError):
page.save()
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1041631?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Iafcc1646f3c5080c5919f4814d9658508307f82f
Gerrit-Change-Number: 1041631
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot