tests.file_tests module#

FilePage tests.

class tests.file_tests.TestFilePage(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test FilePage.latest_revision_info.

These tests cover exceptions for all properties and methods in FilePage that rely on site.loadimageinfo.

abstract_class = False#
cached = True#
code = 'test'#
family = 'wikipedia'#
file_name = 'File:Albert Einstein Head.jpg'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_file_info_with_no_file()[source]#

FilePage:latest_file_info raises PagerelatedError if no file.

test_file_info_with_no_page()[source]#

FilePage:latest_file_info raises NoPageError for missing pages.

class tests.file_tests.TestFilePageCommons(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test methods of the FilePage class on Commons.

abstract_class = False#
cached = True#
code = 'commons'#
family = 'commons'#
net = True#
site = True#
sites = {'commons:commons': {'code': 'commons', 'family': 'commons'}}#
test_globalusage_commons_commons()#

Test globalusage generator on commons:commons

class tests.file_tests.TestFilePageDataItem(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test structured data of FilePage.

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

Test associated data item.

test_data_item_not_existing()[source]#

Test data item associated to file that does not exist.

class tests.file_tests.TestFilePageDownload(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test download of FilePage to local file.

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

Test not existing download.

test_successful_download()[source]#

Test successful_download.

class tests.file_tests.TestFilePageLatestFileInfo(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test FilePage.latest_file_info.

These tests cover properties and methods in FilePage that rely on site.loadimageinfo.

abstract_class = False#
cached = True#
code = 'commons'#
family = 'commons'#
file_name = 'File:Albert Einstein Head.jpg'#
net = True#
setUp()[source]#

Create File page.

site = True#
sites = {'commons:commons': {'code': 'commons', 'family': 'commons'}}#
test_get_file_url()[source]#

Get File url.

test_get_file_url_thumburl_from_heigth()[source]#

Get File thumburl from height.

test_get_file_url_thumburl_from_url_param()[source]#

Get File thumburl from height.

test_get_file_url_thumburl_from_width()[source]#

Get File thumburl from width.

class tests.file_tests.TestSharedFiles(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test file_is_shared, exists, fileUrl/get_file_url with shared files.

abstract_class = False#
cached = True#
net = True#
site = True#
sites = {'commons': {'code': 'commons', 'family': 'commons'}, 'enwiki': {'code': 'en', 'family': 'wikipedia'}, 'itwiki': {'code': 'it', 'family': 'wikipedia'}, 'testwiki': {'code': 'test', 'family': 'wikipedia'}}#
test_local_only()[source]#

Test file_is_shared() on file page with local file only.

test_non_file_local()[source]#

Test file page, without local file, existing on the local wiki.

test_on_both()[source]#

Test file_is_shared() on file page with local and shared file.

test_shared_only()[source]#

Test file_is_shared() on file page with shared file only.