John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/233912
Change subject: Mark site.patrol() as a user write action ...................................................................... Mark site.patrol() as a user write action The patrol tests should only be used on test sites. Change-Id: I0ab4dc20f82857505236c0c678a602c02c001e37 --- M pywikibot/site.py M tests/aspects.py M tests/site_tests.py 3 files changed, 14 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/12/233912/1 diff --git a/pywikibot/site.py b/pywikibot/site.py index 3666f03..98c25ca 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -4909,6 +4909,7 @@ "notpatrollable": "The revision %(revid)s can't be patrolled as it's too old." } + @must_be(group='user') @deprecated_args(token=None) def patrol(self, rcid=None, revid=None, revision=None): """Return a generator of patrolled pages. diff --git a/tests/aspects.py b/tests/aspects.py index de3ca79..af4ae7a 100644 --- a/tests/aspects.py +++ b/tests/aspects.py @@ -542,7 +542,6 @@ super(SiteWriteMixin, cls).setUpClass() site = cls.get_site() - assert 'test' in (site.family.name, site.code) if cls.write == -1: env_var = 'PYWIKIBOT2_TEST_WRITE_FAIL' @@ -558,9 +557,11 @@ if issubclass(cls, ForceCacheMixin): raise Exception( '%s can not be a subclass of both ' - 'SiteEditTestCase and ForceCacheMixin' + 'SiteWriteMixin and ForceCacheMixin' % cls.__name__) + assert 'test' in (site.family.name, site.code) + class RequireUserMixin(TestCaseBase): diff --git a/tests/site_tests.py b/tests/site_tests.py index 0552bea..0b61629 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -1559,9 +1559,9 @@ self.assertTrue(len(revs) > 2) -class SiteUserTestCase2(DefaultSiteTestCase): +class SiteUsersTestCaseAsUser(DefaultSiteTestCase): - """More tests that rely on a user account.""" + """Test the site.users() method with logged in user.""" user = True @@ -1577,6 +1577,14 @@ self.assertTrue(user["name"] in ["Jimbo Wales", "Brion VIBBER", "Tim Starling"]) + +class SitePatrolTestCase(DefaultSiteTestCase): + + """Test patrol() action.""" + + user = True + write = True + def testPatrol(self): """Test the site.patrol() method.""" mysite = self.get_site() -- To view, visit https://gerrit.wikimedia.org/r/233912 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0ab4dc20f82857505236c0c678a602c02c001e37 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg <jay...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits