def test_protect(self): """Test ProtectionBot protect/unprotect on the test wiki.""" site = self.get_site() protect.main('-page:User:Sn1per/ProtectTest1', '-always', '-unprotect', '-summary=Pywikibot protect.py unit tests') page = pywikibot.Page(site, 'User:Sn1per/ProtectTest1') self.assertIsEmpty(list(page.protection())) protect.main('-page:User:Sn1per/ProtectTest1', '-always', '-default', '-summary=Pywikibot protect.py unit tests') page = pywikibot.Page(site, 'User:Sn1per/ProtectTest1') self.assertLength(list(page.protection()), 2)
def test_protect(self): """Test ProtectionBot protect/unprotect on the test wiki.""" site = self.get_site() protect.main('-page:User:Sn1per/ProtectTest1', '-always', '-unprotect', '-summary=Pywikibot protect.py unit tests') page = pywikibot.Page(site, 'User:Sn1per/ProtectTest1') self.assertEqual(len(list(page.protection())), 0) protect.main('-page:User:Sn1per/ProtectTest1', '-always', '-default', '-summary=Pywikibot protect.py unit tests') page = pywikibot.Page(site, 'User:Sn1per/ProtectTest1') self.assertEqual(len(list(page.protection())), 2)
def test_protect(self): """Test ProtectionBot protect/unprotect on the test wiki.""" site = self.get_site() protect.main( "-page:User:Sn1per/ProtectTest1", "-always", "-unprotect", "-summary=Pywikibot protect.py unit tests" ) page = pywikibot.Page(site, "User:Sn1per/ProtectTest1") self.assertEqual(len(list(page.protection())), 0) protect.main( "-page:User:Sn1per/ProtectTest1", "-always", "-default", "-summary=Pywikibot protect.py unit tests" ) page = pywikibot.Page(site, "User:Sn1per/ProtectTest1") self.assertEqual(len(list(page.protection())), 2)