As agreed with gustavo we'll continue this on the mailing list.

To the ones just joining we are discussing how to write webtests for
auth enable pages.

My suggestion is to add something like the following to the end of
http://trac.turbogears.org/browser/projects/tg.devtools/trunk/devtools/templates/turbogears/%2Bpackage%2B/tests/__init__.py_tmpl

class AuthTestController(TestController):
    def login(self,username,password):
         <some code>
    def logout(self):
         <some code>

--------------------------------------
So you will write tests like

class TestAdminPermissions(AuthTestController):
    def setup():
        self.login('manager',managepass')
    def test_go_admin(self):
        self.app.get('/admin')
        <success manager can see /admin>
.....

class TestUserPermission(AuthTestController):
    def test_go_admin(self):
        self.app.get('/admin')
         <fail anon can't see /admin>


This means one test class = one set of rules satisfied by one
predicate (or set of predicates) the drawback is that you will have to
set users for each type/group of predicate instead of testing directly
for the predicate.

A second option is to simply provide login and logout as two module
level functions this will allow even more rich testing sets as you can
call them from any of the nose fixtures. (package, module, class or
even function)

Another variable of this was 'contributed' by ChrisP and is posted
here http://paste.turbogears.org/paste/34752 the problem with this one
is that it
a- by passes authentication
b- uses "private" r.what api

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to