tests.site_tests module#

Tests for the site module.

class tests.site_tests.SiteSysopTestCase(*args, **kwargs)[source]#

Bases: RequireLoginMixin, NeedRightsMixin, CheckHostnameMixin, DefaultSiteTestCase

Test site method using a sysop account.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
login = True#
net = True#
rights = 'delete'#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_alldeletedrevisions()[source]#

Test the site.alldeletedrevisions() method.

test_deletedrevs()[source]#

Test the site.deletedrevs() method.

test_methods()[source]#

Test sysop related methods.

class tests.site_tests.SiteUserTestCase(*args, **kwargs)[source]#

Bases: RequireLoginMixin, CheckHostnameMixin, DefaultSiteTestCase

Test site method using a user.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
login = True#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_logevents()[source]#

Test the site.logevents() method.

test_methods()[source]#

Test user related methods.

class tests.site_tests.TestCategoryFromWikibase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test page_from_repository method.

ITEM = 'Q6939656'#
abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'de-wp': {'code': 'de', 'family': 'wikipedia', 'result': 'Kategorie:2016'}, 'en-wp': {'code': 'en', 'family': 'wikipedia', 'result': 'Category:2016'}, 'it-ws': {'code': 'it', 'family': 'wikisource', 'result': 'Categoria:2016'}}#
test_page_from_repository_de_wp()#

Validate page_from_repository on wikipedia:de

test_page_from_repository_en_wp()#

Validate page_from_repository on wikipedia:en

test_page_from_repository_it_ws()#

Validate page_from_repository on wikisource:it

test_page_from_repository_none()[source]#

Validate page_from_repository return NoneType.

class tests.site_tests.TestCommonsSite(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test cases for Site methods on Commons.

abstract_class = False#
cached = True#
code = 'commons'#
family = 'commons'#
net = True#
site = True#
sites = {'commons:commons': {'code': 'commons', 'family': 'commons'}}#
test_interwiki_forward()[source]#

Test interwiki forward.

class tests.site_tests.TestLinktrails(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCase

Test linktrail method.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_has_linktrail()[source]#

Verify that every code has a linktrail.

Test all smallest wikis and the others randomly.

test_linktrails()[source]#

Test special linktrails.

This is a subset of the old family.linktrails dict.

class tests.site_tests.TestLockingPage(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase

Test cases for lock/unlock a page within threads.

abstract_class = False#
cached = True#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_lock_page()[source]#

Test the site.lock_page() and site.unlock_page() method.

test_threads_locking_page()[source]#

Test lock_page and unlock_page methods for multiple threads.

worker()[source]#

Lock a page, wait few seconds and unlock the page.

class tests.site_tests.TestNonEnglishWikipediaSite(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test Site Object on Nynorsk Wikipedia.

abstract_class = False#
cached = True#
code = 'nn'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:nn': {'code': 'nn', 'family': 'wikipedia'}}#
test_namespace_aliases()[source]#

Test namespace aliases.

class tests.site_tests.TestObsoleteSite(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test ‘closed’ and obsolete code sites.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_alias_code_site()[source]#

Test Wikimedia site with an alias code.

test_locked_site()[source]#

Test Wikimedia closed/locked site.

test_removed_site()[source]#

Test Wikimedia offline site.

class tests.site_tests.TestPageFromWikibase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test page_from_repository method.

ITEM = 'Q131303'#
abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'de-wp': {'code': 'de', 'family': 'wikipedia', 'result': 'Hallo-Welt-Programm'}, 'en-wp': {'code': 'en', 'family': 'wikipedia', 'result': '"Hello, World!" program'}, 'it-wb': {'code': 'it', 'family': 'wikibooks', 'result': 'Hello world'}}#
test_page_from_repository_de_wp()#

Validate page_from_repository on wikipedia:de

test_page_from_repository_en_wp()#

Validate page_from_repository on wikipedia:en

test_page_from_repository_it_wb()#

Validate page_from_repository on wikibooks:it

test_page_from_repository_none()[source]#

Validate page_from_repository return NoneType.

class tests.site_tests.TestProductionAndTestSite(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, AlteredDefaultSiteTestCase

Test site without other production sites in its family.

abstract_class = False#
net = True#
site = True#
sites = {'beta': {'code': 'beta', 'family': 'commons'}, 'commons': {'code': 'commons', 'family': 'commons'}, 'wikidata': {'code': 'wikidata', 'family': 'wikidata'}, 'wikidatatest': {'code': 'test', 'family': 'wikidata'}}#
test_commons()[source]#

Test Wikimedia Commons.

test_wikidata()[source]#

Test Wikidata family, with sites for test and production.

class tests.site_tests.TestPropertyNames(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase

Test Special:PagesWithProp method.

abstract_class = False#
cached = True#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'de-wp': {'code': 'de', 'family': 'wikipedia'}, 'en-ws': {'code': 'en', 'family': 'wikisource'}}#
test_get_property_names_de_wp()#

Test get_property_names method on wikipedia:de

test_get_property_names_en_ws()#

Test get_property_names method on wikisource:en

class tests.site_tests.TestSametitleSite(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCase

Test APISite.sametitle on sites with known behaviour.

abstract_class = False#
net = True#
site = True#
sites = {'dewp': {'code': 'de', 'family': 'wikipedia'}, 'enwp': {'code': 'en', 'family': 'wikipedia'}, 'enwt': {'code': 'en', 'family': 'wiktionary'}}#
test_dewp()[source]#

Test sametitle for dewp.

test_enwp()[source]#

Test sametitle for enwp.

test_enwt()[source]#

Test sametitle for enwt.

test_general_dewp()#

Test sametitle on wikipedia:de

test_general_enwp()#

Test sametitle on wikipedia:en

test_general_enwt()#

Test sametitle on wiktionary:en

class tests.site_tests.TestSingleCodeFamilySite(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, AlteredDefaultSiteTestCase

Test single code family sites.

abstract_class = False#
net = True#
site = True#
sites = {'i18n': {'code': 'i18n', 'family': 'i18n'}}#
test_twn()[source]#

Test translatewiki.net.

class tests.site_tests.TestSiteDryDeprecatedFunctions(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, DefaultDrySiteTestCase, DeprecationTestCase

Test cases for Site deprecated methods without a user.

abstract_class = False#
code = 'test'#
dry = True#
family = 'wikipedia'#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_namespaces_callable()[source]#

Test that namespaces is callable and returns itself.

class tests.site_tests.TestSiteExtensions(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, WikimediaDefaultSiteTestCase

Test cases for Site extensions.

abstract_class = False#
cached = True#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_extensions()[source]#

Test Extensions.

class tests.site_tests.TestSiteLoadRevisionsCaching(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, BasePageLoadRevisionsCachingTestBase, DefaultSiteTestCase

Test site.loadrevisions() caching.

abstract_class = False#
cached = False#
code = 'test'#
family = 'wikipedia'#
net = True#
setUp()[source]#

Setup tests.

site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_page_text()[source]#

Test site.loadrevisions() with Page.text.

class tests.site_tests.TestSiteObject(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase

Test cases for Site methods.

abstract_class = False#
cached = True#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_constructors()[source]#

Test cases for site constructors.

test_english_specific_methods()[source]#

Test Site methods using English specific inputs and outputs.

test_language_methods()[source]#

Test cases for languages() and related methods.

test_messages()[source]#

Test MediaWiki: messages.

test_namespace_methods()[source]#

Test cases for methods manipulating namespace names.

test_page_methods()[source]#

Test ApiSite methods for getting page-specific info.

test_pickle_ability()[source]#

Test pickle ability.

test_repr()[source]#

Test __repr__.

test_user_attributes_return_types()[source]#

Test returned types of user attributes.

class tests.site_tests.TestSiteObjectDeprecatedFunctions(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase, DeprecationTestCase

Test cases for Site deprecated methods on a live wiki.

abstract_class = False#
cached = True#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_allpages_filterredir_talse()[source]#

Test if filterredir’s bool is False it’s deprecated to False.

test_allpages_filterredir_true()[source]#

Test that filterredir set to ‘only’ is deprecated to True.

class tests.site_tests.TestSiteProofreadinfo(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase

Test proofreadinfo information.

abstract_class = False#
cached = True#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'en-wp': {'code': 'en', 'family': 'wikipedia'}, 'en-ws': {'code': 'en', 'family': 'wikisource'}}#
test_cache_proofreadinfo_on_site_with_proofreadpage()[source]#

Test Site._cache_proofreadinfo().

test_cache_proofreadinfo_on_site_without_proofreadpage()[source]#

Test Site._cache_proofreadinfo().

class tests.site_tests.TestSiteSysopWrite(*args, **kwargs)[source]#

Bases: RequireLoginMixin, NeedRightsMixin, SiteWriteMixin, CheckHostnameMixin, TestCase

Test site methods that require writing rights.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
login = True#
net = True#
rights = 'delete,deleterevision,protect'#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_delete()[source]#

Test the site.delete() and site.undelete() methods.

test_delete_oldimage()[source]#

Test deleting and undeleting specific versions of files.

test_protect()[source]#

Test the site.protect() method.

test_protect_alt()[source]#

Test the site.protect() method, works around T78522.

test_protect_exception()[source]#

Test that site.protect() throws an exception for invalid args.

test_revdel_file()[source]#

Test deleting and undeleting file revisions.

test_revdel_page()[source]#

Test deleting and undeleting page revisions.

write = True#
class tests.site_tests.TestSubdomainFamilySite(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCase

Test subdomain family site.

abstract_class = False#
code = 'en'#
family = 'wowwiki'#
net = True#
site = True#
sites = {'wowwiki:en': {'code': 'en', 'family': 'wowwiki'}}#
test_wow()[source]#

Test wowwiki.fandom.com.

class tests.site_tests.TestUploadEnabledSite(*args, **kwargs)[source]#

Bases: RequireLoginMixin, CheckHostnameMixin, TestCase

Test Site.is_uploaddisabled.

abstract_class = False#
login = True#
net = True#
site = True#
sites = {'wikidatatest': {'code': 'test', 'disabled': True, 'family': 'wikidata'}, 'wikipediatest': {'code': 'test', 'disabled': False, 'family': 'wikipedia'}}#
test_is_uploaddisabled_wikidatatest()#

Test is_uploaddisabled() on wikidata:test

test_is_uploaddisabled_wikipediatest()#

Test is_uploaddisabled() on wikipedia:test

class tests.site_tests.TestUsernameInUsers(*args, **kwargs)[source]#

Bases: RequireLoginMixin, CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase

Test that the user account can be found in users list.

abstract_class = False#
cached = True#
code = 'test'#
family = 'wikipedia'#
login = True#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_username_in_users()[source]#

Test the site.users() method with bot username.

class tests.site_tests.TestWiktionarySite(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test Site Object on English Wiktionary.

abstract_class = False#
cached = True#
code = 'en'#
family = 'wiktionary'#
net = True#
site = True#
sites = {'wiktionary:en': {'code': 'en', 'family': 'wiktionary'}}#
test_namespace_case()[source]#

Test namespace case.