Mercurial > hg > ltpdarepo
changeset 94:65c700a145c9
Cleanup and extend doctests.
author | Daniele Nicolodi <daniele@grinta.net> |
---|---|
date | Sun, 21 Aug 2011 18:17:27 +0200 |
parents | 8fd53ae8818a |
children | 601d49a7c353 |
files | src/ltpdarepo/tests/browse-database.txt src/ltpdarepo/tests/browse-user.txt src/ltpdarepo/tests/manage-databases.txt src/ltpdarepo/tests/manage-users.txt |
diffstat | 4 files changed, 51 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ltpdarepo/tests/browse-database.txt Sun Aug 21 18:17:27 2011 +0200 +++ b/src/ltpdarepo/tests/browse-database.txt Sun Aug 21 18:17:27 2011 +0200 @@ -34,7 +34,6 @@ >>> browser.open('/browse/db1/1/mat') Traceback (most recent call last): - ... HTTPError: HTTP Error 404: NOT FOUND Simple search:: @@ -66,3 +65,7 @@ >>> browser.url 'http://localhost/browse/db1/activity' + +# Local Variables: +# mode: doctest +# End:
--- a/src/ltpdarepo/tests/browse-user.txt Sun Aug 21 18:17:27 2011 +0200 +++ b/src/ltpdarepo/tests/browse-user.txt Sun Aug 21 18:17:27 2011 +0200 @@ -61,6 +61,20 @@ >>> browser.url 'http://localhost/user/u1' +Password and confirm fields should have the same value:: + + >>> browser.getLink('Change password').click() + >>> browser.url + 'http://localhost/user/u1/password' + + >>> browser.getControl(name='password').value = 'new' + >>> browser.getControl(name='confirm').value = 'old' + >>> browser.getControl(name='submit').click() + >>> browser.url + 'http://localhost/user/u1/password' + >>> browser.contents + '...<span class="error">Passwords do not match.</span>...' + Logout and login again with the new credentials:: >>> browser.getLink('logout').click() @@ -77,7 +91,6 @@ >>> browser.open('/user/u2') Traceback (most recent call last): - ... HTTPError: HTTP Error 403: ... Check that we can not edit someone else profile:: @@ -87,15 +100,17 @@ >>> browser.open('/user/u2') Traceback (most recent call last): - ... HTTPError: HTTP Error 403: ... >>> browser.open('/user/u2/edit') Traceback (most recent call last): - ... HTTPError: HTTP Error 403: ... >>> browser.open('/user/u2/password') Traceback (most recent call last): - ... HTTPError: HTTP Error 403: ... + + +# Local Variables: +# mode: doctest +# End:
--- a/src/ltpdarepo/tests/manage-databases.txt Sun Aug 21 18:17:27 2011 +0200 +++ b/src/ltpdarepo/tests/manage-databases.txt Sun Aug 21 18:17:27 2011 +0200 @@ -56,6 +56,17 @@ >>> browser.contents '...<p class="field"><span class="label">Description:</span> Test Database One</p>...' +Cannot create database with bad id:: + + >>> browser.open('/manage/databases/') + >>> browser.getLink('Create database').click() + >>> browser.getControl(name='id').value = '#' + >>> browser.getControl(name='submit').click() + >>> browser.url + 'http://localhost/manage/databases/+' + >>> browser.contents + '...<span class="error">Invalid ID.</span>...' + Cannot create database with duplicate id:: >>> browser.open('/manage/databases/') @@ -99,3 +110,7 @@ >>> browser.contents '...<div class="flash message">Database "database1" deleted.</div>...' + +# Local Variables: +# mode: doctest +# End:
--- a/src/ltpdarepo/tests/manage-users.txt Sun Aug 21 18:17:27 2011 +0200 +++ b/src/ltpdarepo/tests/manage-users.txt Sun Aug 21 18:17:27 2011 +0200 @@ -9,7 +9,7 @@ >>> browser.open('/') >>> browser.url 'http://localhost/login' - + >>> browser.getControl(name='username').value = USERNAME >>> browser.getControl(name='password').value = PASSWORD >>> browser.getControl(name='login').click() @@ -22,6 +22,13 @@ >>> browser.url 'http://localhost/manage/users/' +View user profile:: + + >>> browser.getLink('u1', index=1).click() + >>> browser.url + 'http://localhost/manage/users/u1' + >>> browser.goBack() + Create a new user:: >>> browser.getLink('Create new user').click() @@ -164,3 +171,8 @@ 'http://localhost/manage/users/+' >>> browser.contents '...<span class="error">MySQL already contains an user with this username.</span>...' + + +# Local Variables: +# mode: doctest +# End: