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_file()[source]#

Test data item with invalid pageid.

test_data_item_when_file_exist_but_without_item()[source]#

Test if data item is missing from file.

test_data_item_when_no_file_or_data_item()[source]#

Test data item associated to file that does not exist.

test_data_list_to_dict_workaround()[source]#

Test that T222159 workaround converts [] to {}.

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_changed_title()[source]#

Test changed title.

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.

test_lazyload_metadata()[source]#

Test metadata lazy load.

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

Bases: RequireLoginMixin, SiteWriteMixin, CheckHostnameMixin, TestCase

Test writing structured data of FilePage.

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

Test addClaim and removeClaim editing.

test_edit_label()[source]#

Test label editing.

write = True#
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.