def test_get_user_contribs(limit): client = WapitiClient('*****@*****.**') get_contribs = partial(client.get_user_contribs, 'Jimbo Wales', limit) contribs = call_and_ret(get_contribs) return len(contribs) == limit
def test_get_meta(limit): client = WapitiClient('*****@*****.**') get_source_info = client.get_source_info meta = call_and_ret(get_source_info) return len(meta[0].interwiki_map) > 1
def test_get_links(limit): client = WapitiClient('*****@*****.**') get_links = partial(client.get_links, 'Coffee', limit) links = call_and_ret(get_links) return len(links) == limit
def test_geosearch(limit): client = WapitiClient('*****@*****.**') geosearch = partial(client.geo_search, ('37.8197', '-122.479')) geo = call_and_ret(geosearch) return len(geo) > 1
def test_client_basic(limit): client = WapitiClient('*****@*****.**') return len(client.source_info.namespace_map) > 10
def test_multi_prots_str(limit): client = WapitiClient('*****@*****.**') get_prots = partial(client.get_protections, 'Coffee|House') prots = call_and_ret(get_prots) return len(prots) == 2
def test_current_content(limit): client = WapitiClient('*****@*****.**') get_page = partial(client.get_current_content, 'Coffee') page = call_and_ret(get_page) return page[0].title == 'Coffee'
def test_get_templates(limit): client = WapitiClient('*****@*****.**') get_templates = partial(client.get_templates, 'Coffee', limit) tmpl = call_and_ret(get_templates) return len(tmpl) == limit
def test_feedback_v5(limit): client = WapitiClient('*****@*****.**') get_v5 = partial(client.get_feedback_v5, '604727') # TODO: support ints v5_list = call_and_ret(get_v5) return isinstance(v5_list, list)
def test_revisions(limit): client = WapitiClient('*****@*****.**') get_revs = partial(client.get_page_revision_infos, 'Coffee', 10) rev_list = call_and_ret(get_revs) return len(rev_list) == 10
def test_interwiki_links(limit): client = WapitiClient('*****@*****.**') get_coffee_iwlinks = partial(client.get_interwiki_links, 'Coffee', limit) iw_list = call_and_ret(get_coffee_iwlinks) return len(iw_list) == limit
def test_lang_links(limit): client = WapitiClient('*****@*****.**') get_coffee_langs = partial(client.get_language_links, 'Coffee', limit) lang_list = call_and_ret(get_coffee_langs) return len(lang_list) == limit
def test_random(limit): client = WapitiClient('*****@*****.**') get_fifty_random = partial(client.get_random, limit) pages = call_and_ret(get_fifty_random) return len(pages) == limit
def test_get_revision_infos(limit): client = WapitiClient('*****@*****.**') get_revisions = partial(client.get_revision_infos, ['538903663', '539916351', '531458383']) rev_infos = call_and_ret(get_revisions) return len(rev_infos) == 3
def test_current_talk_content(limit): client = WapitiClient('*****@*****.**') get_talk_page = partial(client.get_current_talk_content, 'Obama') page = call_and_ret(get_talk_page) return page[0].title == 'Talk:Barack Obama'
def test_get_image_info(limit): client = WapitiClient('*****@*****.**') get_image_info = partial(client.get_image_infos, 'File:Logo.gif') image_info = call_and_ret(get_image_info) return image_info[ 0].url == 'http://upload.wikimedia.org/wikipedia/en/e/ea/Logo.gif'
def test_flatten_category(limit): client = WapitiClient('*****@*****.**') get_flat_cat = partial(client.get_flattened_category, 'History', limit) cat_infos = call_and_ret(get_flat_cat) assert len(set([ci.title for ci in cat_infos])) == len(cat_infos) return len(cat_infos) == limit
def test_recent_changes(limit): client = WapitiClient('*****@*****.**') get_recent_changes = partial(client.get_recent_changes, limit) recent_changes = call_and_ret(get_recent_changes) return len(recent_changes) == limit
def test_cat_list(limit): client = WapitiClient('*****@*****.**') get_cat_list = partial(client.get_category_list, 'Physics', limit) pages = call_and_ret(get_cat_list) return len(pages) == limit
def test_cat(limit): client = WapitiClient('*****@*****.**') get_africa = partial(client.get_category_recursive, 'Africa', limit) cat_pages = call_and_ret(get_africa) return len(cat_pages) == limit
def test_single_prot(limit): client = WapitiClient('*****@*****.**') get_coffee_prot = partial(client.get_protections, 'Coffee') prots = call_and_ret(get_coffee_prot) return len(prots) == 1