This is a simple testing framework for wikitools.

To use:

1. Create the user account "Wikitools test"

2. Create a settings.py file containing the username and password for an account on the wiki used for testing.
For example:
test = 'Wikitools test'
testpass = 'password'

3. Change the URL in the test.py script to the API url of the wiki used for testing

4. Upload the file "Wikitools_test_file.jpg" to the wiki using that name
Use the following as the file description:

Test page for [[wikitools]] test framework

==Test section==
File test page

==Test==
{{Wikitools test page}}
[[Category:Wikitools test page]]

5. Import the wikitoolstestpages.xml file using Special:Import

6. Run the script, passing the API url as the sole command line argument


What this script does do:
* Verifies things aren't totally broken
* Gives an easy way to check that output is reasonable

What this script doesn't do:
* Verifies output is correct
* Test write functions (edit, delete, block, etc)
* Test any of the pagelist.py functions
* Test API queries that require multiple requests
* Be very thorough

Pageids, namespaces, site settings can vary from site to site, the output from my own wiki is (using wikitools r194):

Testing wiki
Site: http://main.wikisite:8888 - not logged in <wikitools.wiki.Wiki 'http://main.wikisite:8888/w/api.php' not logged in>
Login: True
Login check: True
Change maxlag: 7
Change UA: python-wikitools/test
NSaliases: {u'TEST': 4, u'Image': 6, u'Relation talk': 103, u'Relation': 102, u'Image talk': 7}
__doc__: A Wiki site
__module__: wikitools.wiki
apibase: http://main.wikisite:8888/w/api.php
cookiepath: 
cookies: <wikitools.wiki.WikiCookieJar[<Cookie mainwikiUserID=5 for main.wikisite/>, <Cookie mainwikiUserName=Wikitools+test for main.wikisite/>, <Cookie mainwiki_session=c65bc4ac6dd23eb0dbd34a1c7da08a67 for main.wikisite/>, <Cookie test_centralauth_Session=61ca64f7c69df75f16b8ac9510f90af6 for main.wikisite/>, <Cookie test_centralauth_Token=c0074b9433d093459855f09224a0d365 for main.wikisite/>, <Cookie test_centralauth_User=Wikitools+test for main.wikisite/>]>
domain: http://main.wikisite:8888
limit: 500
maxlag: 7
maxwaittime: 120
namespaces: {0: {u'content': u'', u'*': u'', u'id': 0}, 1: {u'subpages': u'', u'*': u'Talk', u'id': 1, u'canonical': u'Talk'}, 2: {u'subpages': u'', u'*': u'User', u'id': 2, u'canonical': u'User'}, 3: {u'subpages': u'', u'*': u'User talk', u'id': 3, u'canonical': u'User talk'}, 4: {u'subpages': u'', u'*': u'MainWiki', u'id': 4, u'canonical': u'Project'}, 5: {u'subpages': u'', u'*': u'MainWiki talk', u'id': 5, u'canonical': u'Project talk'}, 6: {u'*': u'File', u'id': 6, u'canonical': u'File'}, 7: {u'subpages': u'', u'*': u'File talk', u'id': 7, u'canonical': u'File talk'}, 8: {u'subpages': u'', u'*': u'MediaWiki', u'id': 8, u'canonical': u'MediaWiki'}, 9: {u'subpages': u'', u'*': u'MediaWiki talk', u'id': 9, u'canonical': u'MediaWiki talk'}, 10: {u'*': u'Template', u'id': 10, u'canonical': u'Template'}, 11: {u'subpages': u'', u'*': u'Template talk', u'id': 11, u'canonical': u'Template talk'}, 12: {u'*': u'Help', u'id': 12, u'canonical': u'Help'}, 13: {u'subpages': u'', u'*': u'Help talk', u'id': 13, u'canonical': u'Help talk'}, 14: {u'*': u'Category', u'id': 14, u'canonical': u'Category'}, 15: {u'subpages': u'', u'*': u'Category talk', u'id': 15, u'canonical': u'Category talk'}, 102: {u'*': u'Property', u'id': 102, u'canonical': u'Property'}, 103: {u'subpages': u'', u'*': u'Property talk', u'id': 103, u'canonical': u'Property talk'}, 104: {u'*': u'Type', u'id': 104, u'canonical': u'Type'}, 105: {u'subpages': u'', u'*': u'Type talk', u'id': 105, u'canonical': u'Type talk'}, 106: {u'*': u'Form', u'id': 106, u'canonical': u'Form'}, 107: {u'subpages': u'', u'*': u'Form talk', u'id': 107, u'canonical': u'Form talk'}, 108: {u'*': u'Concept', u'id': 108, u'canonical': u'Concept'}, 109: {u'*': u'Concept talk', u'id': 109, u'canonical': u'Concept talk'}, -2: {u'*': u'Media', u'id': -2, u'canonical': u'Media'}, -1: {u'*': u'Special', u'id': -1, u'canonical': u'Special'}}
siteinfo: {u'wikiid': u'mainwiki', u'scriptpath': u'/w', u'timezone': u'UTC', u'phpversion': u'5.3.0', u'script': u'/w/index.php', u'sitename': u'MainWiki', u'rev': 53739, u'variantarticlepath': False, u'timeoffset': 0, u'writeapi': u'', u'case': u'first-letter', u'dbversion': u'5.1.35', u'base': u'http://main.wikisite:8888/wiki/Main_Page', u'articlepath': u'/wiki/$1', u'lang': u'en', u'fallback8bitEncoding': u'windows-1252', u'generator': u'MediaWiki 1.16alpha', u'rights': u'', u'phpsapi': u'apache2handler', u'server': u'http://main.wikisite:8888', u'dbtype': u'mysql', u'mainpage': u'Main Page'}
useragent: python-wikitools/test
username: Wikitools test

Testing page
Page:  Page u'Wikitools test page' from 'http://main.wikisite:8888' <wikitools.page.Page u'Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>
Subpage check: False
Redirect check: False
Talk check: False
Talk page: Page u'Talk:Wikitools test page' from 'http://main.wikisite:8888'
Wikitext: Test page for [[wikitools]] test framework

==Test section==
Mainspace test page

==Test==
{{Wikitools test page}}
[[Category:Wikitools test page]]
Links: [u'Wikitools']
Protection: {}
Templates: [u'Template:Wikitools test page']
Edit token: fd234d8254a9440f57c2668e975bf9a2+\
Changing section: 1
Wikitext II: ==Test section==
Mainspace test page
Changing namespace: 4
Wikitext III: ==Test section==
Projectspace test page
Links II [u'Wikitools']
__class__: <class 'wikitools.page.Page'>
__delattr__: <method-wrapper '__delattr__' of Page object at 0x907844c>
__dict__: {'templates': [], 'wikitext': '==Test section==\nProjectspace test page', 'pageid': u'63', 'exists': True, 'links': [u'Wikitools'], 'urltitle': 'MainWiki%3AWikitools_test_page', 'section': 1, 'title': u'MainWiki:Wikitools test page', 'namespace': 4, 'site': <wikitools.wiki.Wiki 'http://main.wikisite:8888/w/api.php' User:Wikitools test>, 'followRedir': True, 'unprefixedtitle': u'Wikitools test page', 'protection': {}, 'lastedittime': u'2009-07-25T04:25:43Z'}
__doc__:  A page on the wiki
__format__: <built-in method __format__ of Page object at 0x907844c>
__getattribute__: <method-wrapper '__getattribute__' of Page object at 0x907844c>
__hash__: <method-wrapper '__hash__' of Page object at 0x907844c>
__module__: wikitools.page
__new__: <built-in method __new__ of type object at 0x7e501c0>
__reduce__: <built-in method __reduce__ of Page object at 0x907844c>
__reduce_ex__: <built-in method __reduce_ex__ of Page object at 0x907844c>
__setattr__: <method-wrapper '__setattr__' of Page object at 0x907844c>
__sizeof__: <built-in method __sizeof__ of Page object at 0x907844c>
__subclasshook__: <built-in method __subclasshook__ of type object at 0x9054b44>
__weakref__: None
exists: True
followRedir: True
lastedittime: 2009-07-25T04:25:43Z
links: [u'Wikitools']
namespace: 4
pageid: 63
protection: {}
section: 1
site: http://main.wikisite:8888 - using User:Wikitools test
templates: []
title: MainWiki:Wikitools test page
unprefixedtitle: Wikitools test page
urltitle: MainWiki%3AWikitools_test_page
wikitext: ==Test section==
Projectspace test page

Testing category
Category:  Category u'Category:Wikitools test page' from 'http://main.wikisite:8888' <wikitools.category.Category u'Category:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>
Members I: [<wikitools.page.Page u'MainWiki:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>]
Members II: [<wikitools.page.Page u'File:Wikitools test file.jpg' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'MainWiki:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Template:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>]
Members III: [<wikitools.page.Page u'MainWiki:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>]
__class__: <class 'wikitools.category.Category'>
__delattr__: <method-wrapper '__delattr__' of Category object at 0x908a72c>
__dict__: {'templates': [], 'wikitext': '', 'pageid': 65, 'exists': True, 'links': [], 'urltitle': 'Category%3AWikitools_test_page', 'section': False, 'title': u'Category:Wikitools test page', 'namespace': 14, 'site': <wikitools.wiki.Wiki 'http://main.wikisite:8888/w/api.php' User:Wikitools test>, 'followRedir': False, 'unprefixedtitle': u'Wikitools test page', 'protection': {}, 'members': [<wikitools.page.Page u'File:Wikitools test file.jpg' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'MainWiki:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Template:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>]}
__doc__: A category on the wiki
__format__: <built-in method __format__ of Category object at 0x908a72c>
__getattribute__: <method-wrapper '__getattribute__' of Category object at 0x908a72c>
__hash__: <method-wrapper '__hash__' of Category object at 0x908a72c>
__module__: wikitools.category
__new__: <built-in method __new__ of type object at 0x7e501c0>
__reduce__: <built-in method __reduce__ of Category object at 0x908a72c>
__reduce_ex__: <built-in method __reduce_ex__ of Category object at 0x908a72c>
__setattr__: <method-wrapper '__setattr__' of Category object at 0x908a72c>
__sizeof__: <built-in method __sizeof__ of Category object at 0x908a72c>
__subclasshook__: <built-in method __subclasshook__ of type object at 0x9055024>
__weakref__: None
exists: True
followRedir: False
links: []
members: [<wikitools.page.Page u'File:Wikitools test file.jpg' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'MainWiki:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Template:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>]
namespace: 14
pageid: 65
protection: {}
section: False
site: http://main.wikisite:8888 - using User:Wikitools test
templates: []
title: Category:Wikitools test page
unprefixedtitle: Wikitools test page
urltitle: Category%3AWikitools_test_page
wikitext: 

Testing file
File:  File 'File:Wikitools test file.jpg' from 'http://main.wikisite:8888' <wikitools.wikifile.File 'File:Wikitools test file.jpg' using 'http://main.wikisite:8888/w/api.php'>
Usage I: [<wikitools.page.Page u'MainWiki:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>]
Usage II: [<wikitools.page.Page u'File:Wikitools test file.jpg' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'MainWiki:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Template:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Category:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>]
Usage III: [<wikitools.page.Page u'MainWiki:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>]
Downloaded file thumbnail: Wikitools test file.jpg
File size: 9022
__class__: <class 'wikitools.wikifile.File'>
__delattr__: <method-wrapper '__delattr__' of File object at 0x908a02c>
__dict__: {'templates': [], 'wikitext': '', 'pageid': 61, 'exists': True, 'links': [], 'urltitle': 'File%3AWikitools_test_file.jpg', 'section': False, 'title': 'File:Wikitools test file.jpg', 'namespace': 6, 'site': <wikitools.wiki.Wiki 'http://main.wikisite:8888/w/api.php' User:Wikitools test>, 'followRedir': False, 'unprefixedtitle': 'Wikitools test file.jpg', 'protection': {}, 'usage': [<wikitools.page.Page u'File:Wikitools test file.jpg' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'MainWiki:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Template:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Category:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>]}
__doc__: A file on the wiki
__format__: <built-in method __format__ of File object at 0x908a02c>
__getattribute__: <method-wrapper '__getattribute__' of File object at 0x908a02c>
__hash__: <method-wrapper '__hash__' of File object at 0x908a02c>
__module__: wikitools.wikifile
__new__: <built-in method __new__ of type object at 0x7e501c0>
__reduce__: <built-in method __reduce__ of File object at 0x908a02c>
__reduce_ex__: <built-in method __reduce_ex__ of File object at 0x908a02c>
__setattr__: <method-wrapper '__setattr__' of File object at 0x908a02c>
__sizeof__: <built-in method __sizeof__ of File object at 0x908a02c>
__subclasshook__: <built-in method __subclasshook__ of type object at 0x9056284>
__weakref__: None
exists: True
followRedir: False
links: []
namespace: 6
pageid: 61
protection: {}
section: False
site: http://main.wikisite:8888 - using User:Wikitools test
templates: []
title: File:Wikitools test file.jpg
unprefixedtitle: Wikitools test file.jpg
urltitle: File%3AWikitools_test_file.jpg
usage: [<wikitools.page.Page u'File:Wikitools test file.jpg' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'MainWiki:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Template:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>, <wikitools.page.Page u'Category:Wikitools test page' using 'http://main.wikisite:8888/w/api.php'>]
wikitext: 

Testing user
User:  User u'Wikitools test' on 'http://main.wikisite:8888' <wikitools.user.User u'Wikitools test' on 'http://main.wikisite:8888/w/api.php'>
__doc__: A user on the wiki
__module__: wikitools.user
blocked: False
editcount: 1
exists: True
groups: []
isIP: False
name: Wikitools test
page: Page u'User:Wikitools test' from 'http://main.wikisite:8888'
site: http://main.wikisite:8888 - using User:Wikitools test



