# HG changeset patch # User Daniele Nicolodi # Date 1323798703 -3600 # Node ID 4d218e82d2032486238192296c1cff81b279f468 # Parent 3fee7db86a99c2715e4f299270e9409b478f61a1 Add doctest for Atom Feed diff -r 3fee7db86a99 -r 4d218e82d203 src/ltpdarepo/tests/browse-feed.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ltpdarepo/tests/browse-feed.txt Tue Dec 13 18:51:43 2011 +0100 @@ -0,0 +1,37 @@ +Test setup:: + + >>> from ltpdarepo.tests.utils import Browser + >>> USERNAME, PASSWORD = 'u1', 'u1' + >>> browser = Browser() + >>> browser.login(USERNAME, PASSWORD) + >>> browser.open('/') + +Obtain link to Atom Feed:: + + >>> browser.open('/browse/db1/') + >>> browser.getLink(url='atom.xml').url + 'http://localhost/browse/db1/.../atom.xml' + +Check that Atom Feed renders correctly:: + + >>> browser.getLink(url='atom.xml').click() + +Check Atom Feed properties:: + + >>> browser.contents # title is database name + '...db1...' + + >>> browser.contents # subtitle is database description + '...Test database One...' + + >>> browser.contents # id should be an absolute url + '...http://localhost/browse/db1/.../atom.xml...' + + >>> browser.contents # as well as other links + '......' + +Check that the authorization token is verified:: + + >>> browser.open('/browse/db1/xxx/atom.xml') + Traceback (most recent call last): + HTTPError: HTTP Error 403: FORBIDDEN diff -r 3fee7db86a99 -r 4d218e82d203 src/ltpdarepo/tests/test_doctests.py --- a/src/ltpdarepo/tests/test_doctests.py Mon Dec 12 16:12:32 2011 +0100 +++ b/src/ltpdarepo/tests/test_doctests.py Tue Dec 13 18:51:43 2011 +0100 @@ -7,7 +7,7 @@ app = admin.Application() app.wipe() app.install() - app.createdb('db1') + app.createdb('db1', description='Test database One') app.populate('db1', 30) app.useradd('u1', admin=True) app.passwd('u1', 'u1') @@ -26,6 +26,7 @@ doctest.DocFileSuite( 'browse-user.txt', 'browse-database.txt', + 'browse-feed.txt', 'manage-users.txt', 'manage-databases.txt', 'manage-queries.txt',