# HG changeset patch # User Daniele Nicolodi # Date 1313943447 -7200 # Node ID 8fd53ae8818ad16df696536f84995bf2f2aaa2fb # Parent 6e9ba2b64d1f87b629e01c56d9961b8cad2ea952 Extend doctests to cover account activation and password reset. diff -r 6e9ba2b64d1f -r 8fd53ae8818a src/ltpdarepo/tests/manage-users.txt --- 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 @@ -36,8 +36,18 @@ >>> browser.contents '...
User created. Activation token: ...
...' +Activate the new user:: + + >>> browser.getLink(url='?token=').click() + >>> browser.url + 'http://localhost/user/user1/activate?token=...' + >>> browser.getControl(name='password').value = 'passwd' + >>> browser.getControl(name='confirm').value = 'passwd' + >>> browser.getControl(name='submit').click() + View user:: + >>> browser.open('/manage/users/') >>> browser.getLink('user1').click() >>> browser.url 'http://localhost/manage/users/user1' @@ -52,42 +62,59 @@ >>> browser.url 'http://localhost/manage/users/user1' -Set password:: - - >>> from ltpdarepo.admin import passwd - >>> passwd('user1', 'passwd1') - Login as the new user:: - >>> browser.open('/logout') - >>> browser.url - 'http://localhost/login' - >>> browser.getControl(name='username').value = 'user1' - >>> browser.getControl(name='password').value = 'passwd1' - >>> browser.getControl(name='login').click() + >>> browser.login('user1', 'passwd') >>> browser.url 'http://localhost/' Login as administrator user:: - >>> browser.open('/logout') - >>> browser.url - 'http://localhost/login' - >>> browser.getControl(name='username').value = USERNAME - >>> browser.getControl(name='password').value = PASSWORD - >>> browser.getControl(name='login').click() + >>> browser.login(USERNAME, PASSWORD) >>> browser.url 'http://localhost/' -Get users management interface:: +Get to the managment interface for the created user:: + + >>> browser.open('/manage/users/user1') + >>> browser.url + 'http://localhost/manage/users/user1' - >>> browser.getLink('Users').click() +Reset password:: + + >>> browser.getLink('Reset password').click() + >>> browser.url + 'http://localhost/manage/users/user1/reset' + >>> browser.getControl(name='ok').click() >>> browser.url 'http://localhost/manage/users/' + >>> browser.contents + '...
Password reset token: ...
...' + +Set the new password:: + + >>> browser.getLink(url='?token=').click() + >>> browser.url + 'http://localhost/user/user1/reset?token=...' + >>> browser.getControl(name='password').value = 'dwssap' + >>> browser.getControl(name='confirm').value = 'dwssap' + >>> browser.getControl(name='submit').click() + +Login as the new user:: + + >>> browser.login('user1', 'dwssap') + >>> browser.url + 'http://localhost/' + +Login as administrator again:: + + >>> browser.login(USERNAME, PASSWORD) + >>> browser.url + 'http://localhost/' Drop just created user:: - >>> browser.getLink('user1').click() + >>> browser.open('/manage/users/user1') >>> browser.url 'http://localhost/manage/users/user1' @@ -113,6 +140,10 @@ Traceback (most recent call last): HTTPError: HTTP Error 404: NOT FOUND + >>> browser.open('/manage/users/foo/reset') + Traceback (most recent call last): + HTTPError: HTTP Error 404: NOT FOUND + It is not possible to create an user with a duplicate username:: >>> browser.open('/manage/users/+')