# HG changeset patch # User Daniele Nicolodi # Date 1313431590 -7200 # Node ID f9d554de37939e4409a0760719232247cddea0ef # Parent b8c1ce7417452dfed2153ff475e1de453351fc4c Add doctest that execises the database browsing views. diff -r b8c1ce741745 -r f9d554de3793 src/ltpdarepo/tests/browse-database.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ltpdarepo/tests/browse-database.txt Mon Aug 15 20:06:30 2011 +0200 @@ -0,0 +1,68 @@ +Test setup:: + + >>> from ltpdarepo.tests.utils import Browser + >>> USERNAME, PASSWORD = 'u1', 'u1' + >>> browser = Browser() + >>> browser.login(USERNAME, PASSWORD) + >>> browser.open('/') + +Check that all the views render correctly. Obtain the database view:: + + >>> browser.getLink('db1').click() + >>> browser.url + 'http://localhost/browse/db1/' + +Objects listing:: + + >>> browser.open('/browse/db1') + >>> browser.getLink('Browse').click() + >>> browser.url + 'http://localhost/browse/db1/objs' + +Get first object:: + + >>> browser.open('/browse/db1/1') + >>> browser.url + 'http://localhost/browse/db1/1' + +and its XML representations:: + + >>> browser.open('/browse/db1/1/xml') + + +The test objects do not have a binary representation in the database:: + + >>> browser.open('/browse/db1/1/mat') + Traceback (most recent call last): + ... + HTTPError: HTTP Error 404: NOT FOUND + +Simple search:: + + >>> browser.open('/browse/db1') + >>> browser.getControl(name='q').value = '' + >>> browser.getForm().submit() + >>> browser.url + 'http://localhost/browse/db1/search?q=' + +Advabced search:: + + >>> browser.open('/browse/db1') + >>> browser.getLink('Advanced search').click() + >>> browser.url + 'http://localhost/browse/db1/query' + +Timeseries search:: + + >>> browser.open('/browse/db1') + >>> browser.getLink('Timeseries search').click() + >>> browser.url + 'http://localhost/browse/db1/timeseries' + +Activity view:: + + >>> browser.open('/browse/db1') + >>> browser.getLink('Show activity').click() + >>> browser.url + 'http://localhost/browse/db1/activity' + diff -r b8c1ce741745 -r f9d554de3793 src/ltpdarepo/tests/test_doctests.py --- a/src/ltpdarepo/tests/test_doctests.py Mon Aug 15 20:06:27 2011 +0200 +++ b/src/ltpdarepo/tests/test_doctests.py Mon Aug 15 20:06:30 2011 +0200 @@ -3,12 +3,14 @@ def doctestSetUp(self): - from ltpdarepo.admin import wipe, install, useradd, grant, createdb + from ltpdarepo.admin import wipe, install, useradd, grant, createdb, populate wipe() install() useradd('u1', 'u1') - grant('u1', '%', ['admin', ]) + grant('u1', '%', ('admin', )) createdb('db1') + grant('u1', 'db1', ('select', )) + populate('db1', 30) def doctestTearDown(self): @@ -21,6 +23,7 @@ suite.addTest( doctest.DocFileSuite( 'browse-user.txt', + 'browse-database.txt', 'manage-users.txt', 'manage-databases.txt', setUp=doctestSetUp, tearDown=doctestTearDown,