tests.dry_api_tests module#

API tests which do not interact with a site.

class tests.dry_api_tests.DryCachedRequestTests(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, SiteAttributeTestCase

Test CachedRequest using real site objects.

abstract_class = False#
dry = True#
setUp()[source]#

Initialize the fake requests.

site = True#
sites = {'altsite': {'code': 'de', 'family': 'wikipedia'}, 'basesite': {'code': 'en', 'family': 'wikipedia'}}#
test_cachefile_path()[source]#

Test the file paths for the cache.

test_create_file_name()[source]#

Test the file names for the cache.

test_expired()[source]#

Test if the request is expired.

test_expiry_formats()[source]#

Test using a timedelta as expiry.

test_get_cache_dir()[source]#

Test that ‘apicache’ is in the cache dir.

test_parameter_types()[source]#

Test _uniquedescriptionstr is identical using different ways.

class tests.dry_api_tests.DryMimeTests(*args, **kwargs)[source]#

Bases: DisableSiteMixin, TestCase

Test MIME request handling without a real site.

abstract_class = False#
test_mime_file_container()[source]#

Test Request._build_mime_request encodes binary.

test_mime_file_payload()[source]#

Test Request._generate_mime_part loads binary as binary.

class tests.dry_api_tests.DryWriteAssertTests(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, DefaultDrySiteTestCase

Test client site write assert.

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

Test Request object when not a user.

test_normal()[source]#

Test Request object when username is correct.

test_unexpected_user()[source]#

Test Request object when username is not correct.

class tests.dry_api_tests.MockCachedRequestKeyTests(*args, **kwargs)[source]#

Bases: DisableSiteMixin, TestCase

Test CachedRequest using moke site objects.

abstract_class = False#
setUp()[source]#

Create a mock family and site.

test_cachefile_path_different_users()[source]#

Test and compare file paths when different usernames are used.

test_unicode()[source]#

Test caching with Unicode content.

class tests.dry_api_tests.ParamInfoDictTests(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, DefaultDrySiteTestCase

Test extracting data from the ParamInfo.

abstract_class = False#
code = 'test'#
dry = True#
family = 'wikipedia'#
paraminfodata = {'paraminfo': {'modules': [{'classname': 'ApiQueryInfo', 'group': 'prop', 'name': 'info', 'parameters': [{'deprecatedvalues': ['preload', 'readable'], 'highlimit': 500, 'index': 1, 'limit': 50, 'lowlimit': 50, 'multi': '', 'name': 'prop', 'type': ['displaytitlenotificationtimestamp', 'protection', 'subjectid', 'talkid', 'url', 'watched', 'watchers', 'preloadcontent', 'preload', 'readable']}], 'path': 'query+info', 'prefix': 'in'}, {'classname': 'ApiQueryTokens', 'group': 'meta', 'name': 'tokens', 'parameters': [{'default': 'csrf', 'highlimit': 500, 'index': 1, 'limit': 50, 'lowlimit': 50, 'multi': '', 'name': 'type', 'type': ['csrf', 'deleteglobalaccount', 'login', 'patrol', 'rollback', 'userrights', 'watch']}], 'path': 'query+tokens', 'prefix': ''}]}}#
setUp()[source]#

Add a real ParamInfo to the DrySite.

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

Test using __getitem__.

test_format()[source]#

Test using a dummy formatted in the new modules-only mode.

test_info_parameter()[source]#

Test parameter() method with ‘info’ module.

test_tokens_parameter()[source]#

Test parameter() method with ‘tokens’ module.

class tests.dry_api_tests.QueryGenTests(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, DefaultDrySiteTestCase

Test QueryGenerator with a real site.

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

Test QueryGenerator constructor.