Show
Ignore:
Timestamp:
2009年08月23日 17时21分57秒 (3 years ago)
Author:
jiangx
Message:

nosetest passed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.2.3.x/pysvnmanager/tests/functional/test_role.py

    r55 r100  
    2626        res = self.app.get(url_for(controller='role')) 
    2727        assert res.status == 302 
    28         self.assertEqual(res.header('location'), 'http://localhost/login') 
     28        self.assertEqual(res.header('location'), '/login') 
    2929 
    3030        # Login as common user 
     
    3232        res = self.app.get(url_for(controller='role')) 
    3333        assert res.status == 302, res.status 
    34         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
    35          
    36         # Permission denied for repos admin(not root admin) 
     34        assert res.header('location')=='/security/failed', res.header('location') 
     35         
     36        # Repos admin(not root admin) can access role controller, but with disabled button. 
    3737        self.login('admin2') 
    3838        res = self.app.get(url_for(controller='role')) 
    39         assert res.status == 302, res.status 
    40         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     39        assert res.status == 200, res.status 
     40        assert """ 
     41    <input type="button" name="save_btn"   value='Save'  onClick="do_save(this.form)" DISABLED> 
     42    <input type="button" name="delete_btn" value='Delete' onClick="do_delete(this.form)" DISABLED> 
     43    <input type="button" name="cancel_btn" value='Cancel' onClick="role_changed()" DISABLED>""" in res.body, res.body[-300:] 
    4144 
    4245        # Login as superuser 
     
    5053        res = self.app.get(url_for(controller='role', action='get_role_info')) 
    5154        assert res.status == 302 
    52         self.assertEqual(res.header('location'), 'http://localhost/login') 
     55        self.assertEqual(res.header('location'), '/login') 
    5356 
    5457        # authz test 
     
    5659        res = self.app.get(url_for(controller='role', action='get_role_info')) 
    5760        assert res.status == 302, res.status 
    58         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     61        assert res.header('location')=='/security/failed', res.header('location') 
    5962         
    6063        # Login as superuser 
     
    125128        res = self.app.get(url_for(controller='role', action='save_group')) 
    126129        assert res.status == 302 
    127         self.assertEqual(res.header('location'), 'http://localhost/login') 
     130        self.assertEqual(res.header('location'), '/login') 
    128131 
    129132        # authz test 
     
    131134        res = self.app.get(url_for(controller='role', action='save_group')) 
    132135        assert res.status == 302, res.status 
    133         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     136        assert res.header('location')=='/security/failed', res.header('location') 
     137 
    134138 
    135139        # Change group members, autodrop=no 
     
    209213        res = self.app.get(url_for(controller='role', action='delete_group')) 
    210214        assert res.status == 302 
    211         self.assertEqual(res.header('location'), 'http://localhost/login') 
     215        self.assertEqual(res.header('location'), '/login') 
    212216 
    213217        # authz test 
     
    215219        res = self.app.get(url_for(controller='role', action='delete_group')) 
    216220        assert res.status == 302, res.status 
    217         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     221        assert res.header('location')=='/security/failed', res.header('location') 
    218222 
    219223        # Delete group failed, ref by other group. 
     
    271275        res = self.app.get(url_for(controller='role', action='save_alias')) 
    272276        assert res.status == 302 
    273         self.assertEqual(res.header('location'), 'http://localhost/login') 
     277        self.assertEqual(res.header('location'), '/login') 
    274278 
    275279        # authz test 
     
    277281        res = self.app.get(url_for(controller='role', action='save_alias')) 
    278282        assert res.status == 302, res.status 
    279         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     283        assert res.header('location')=='/security/failed', res.header('location') 
    280284 
    281285        # Change alias successfully 
     
    348352        res = self.app.get(url_for(controller='role', action='delete_alias')) 
    349353        assert res.status == 302 
    350         self.assertEqual(res.header('location'), 'http://localhost/login') 
     354        self.assertEqual(res.header('location'), '/login') 
    351355 
    352356        # authz test 
     
    354358        res = self.app.get(url_for(controller='role', action='delete_alias')) 
    355359        assert res.status == 302, res.status 
    356         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     360        assert res.header('location')=='/security/failed', res.header('location') 
    357361 
    358362        # Delete alias successfully