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#
edit_action_param_data = {'name': 'edit', 'path': 'edit'}#
family = 'wikipedia'#
prop_info_param_data = {'classname': 'ApiQueryInfo', 'group': 'prop', 'name': 'info', 'parameters': [{'name': 'prop', 'multi': '', 'limit': 500, 'lowlimit': 50, 'highlimit': 500, 'type': ['protection', 'talkid', 'watched', 'watchers', 'notificationtimestamp', 'subjectid', 'url', 'readable', 'preload', 'displaytitle']}, {'name': 'token', 'deprecated': '', 'multi': '', 'limit': 500, 'lowlimit': 50, 'highlimit': 500, 'type': ['edit', 'delete', 'protect', 'move', 'block', 'unblock', 'email', 'import', 'watch']}, {'name': 'continue', 'type': 'string'}], 'path': 'query+info', 'prefix': 'in', 'querytype': 'prop'}#
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_new_format()[source]#

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

test_old_format()[source]#

Test using a dummy formatted in the old mode.

test_parameter()[source]#

Test parameter() method.

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.