Changeset 100

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

nosetest passed.

Location:
branches/0.2.3.x/pysvnmanager/tests
Files:
6 modified

Legend:

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

    r55 r100  
    6060    def __init__(self, *args, **kwargs): 
    6161        self.authz_file = os.path.dirname(__file__) + '/../../config/svn.access.test' 
    62         if pylons.test.pylonsapp: 
     62        if hasattr(pylons.test, "pylonsapp"): 
    6363            wsgiapp = pylons.test.pylonsapp 
    6464        else: 
  • branches/0.2.3.x/pysvnmanager/tests/functional/test_authz.py

    r55 r100  
    2525        res = self.app.get(url_for(controller='authz')) 
    2626        assert res.status == 302 
    27         self.assertEqual(res.header('location'), 'http://localhost/login') 
     27        self.assertEqual(res.header('location'), '/login') 
    2828 
    2929        # Login as common user 
     
    3131        res = self.app.get(url_for(controller='authz')) 
    3232        assert res.status == 302 
    33         self.assertEqual(res.header('location'), 'http://localhost/security/failed', res.header('location')) 
     33        self.assertEqual(res.header('location'), '/security/failed', res.header('location')) 
    3434         
    3535        # Login as repos admin 
     
    5151        res = self.app.get(url_for(controller='authz', action='init_repos_list')) 
    5252        assert res.status == 302 
    53         self.assertEqual(res.header('location'), 'http://localhost/login') 
     53        self.assertEqual(res.header('location'), '/login') 
    5454 
    5555        # authz test 
     
    5757        res = self.app.get(url_for(controller='authz', action='init_repos_list')) 
    5858        assert res.status == 302, res.status 
    59         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     59        assert res.header('location')=='/security/failed', res.header('location') 
    6060 
    6161        # Login as superuser 
     
    7979        res = self.app.get(url_for(controller='authz', action='repos_changed')) 
    8080        assert res.status == 302 
    81         self.assertEqual(res.header('location'), 'http://localhost/login') 
     81        self.assertEqual(res.header('location'), '/login') 
    8282 
    8383        # authz test 
     
    8585        res = self.app.get(url_for(controller='authz', action='repos_changed')) 
    8686        assert res.status == 302, res.status 
    87         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     87        assert res.header('location')=='/security/failed', res.header('location') 
    8888 
    8989        # Login as superuser 
     
    120120        res = self.app.get(url_for(controller='authz', action='path_changed')) 
    121121        assert res.status == 302 
    122         self.assertEqual(res.header('location'), 'http://localhost/login') 
     122        self.assertEqual(res.header('location'), '/login') 
    123123 
    124124        # authz test 
     
    126126        res = self.app.get(url_for(controller='authz', action='path_changed')) 
    127127        assert res.status == 302, res.status 
    128         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     128        assert res.header('location')=='/security/failed', res.header('location') 
    129129 
    130130        self.login('root') 
     
    166166            res = self.app.get(url_for(controller='authz', action='save_authz')) 
    167167            assert res.status == 302 
    168             self.assertEqual(res.header('location'), 'http://localhost/login') 
     168            self.assertEqual(res.header('location'), '/login') 
    169169 
    170170            # authz test 
     
    172172            res = self.app.get(url_for(controller='authz', action='save_authz')) 
    173173            assert res.status == 302, res.status 
    174             assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     174            assert res.header('location')=='/security/failed', res.header('location') 
    175175             
    176176            # Login as superuser 
     
    334334        res = self.app.get(url_for(controller='authz', action='delete_authz')) 
    335335        assert res.status == 302 
    336         assert res.header('location')== 'http://localhost/login', res.header('location') 
     336        assert res.header('location')== '/login', res.header('location') 
    337337 
    338338        # authz test 
     
    340340        res = self.app.get(url_for(controller='authz', action='delete_authz')) 
    341341        assert res.status == 302, res.status 
    342         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     342        assert res.header('location')=='/security/failed', res.header('location') 
    343343 
    344344        authz = self.load_authz() 
  • branches/0.2.3.x/pysvnmanager/tests/functional/test_check.py

    r55 r100  
    2626        res = self.app.get(url_for(controller='check')) 
    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='check')) 
    3333        assert res.status == 302, res.status 
    34         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     34        assert res.header('location')=='/security/failed', res.header('location') 
    3535         
    3636        # Login as repos admin 
     
    5656        res = self.app.get(url_for(controller='check', action='access_map')) 
    5757        assert res.status == 302 
    58         self.assertEqual(res.header('location'), 'http://localhost/login') 
     58        self.assertEqual(res.header('location'), '/login') 
    5959 
    6060        # authz test 
     
    6262        res = self.app.get(url_for(controller='check', action='access_map')) 
    6363        assert res.status == 302, res.status 
    64         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     64        assert res.header('location')=='/security/failed', res.header('location') 
    6565         
    6666        # Login as superuser 
     
    229229        res = self.app.get(url_for(controller='check', action='get_auth_path')) 
    230230        assert res.status == 302 
    231         assert res.header('location')== 'http://localhost/login', res.header('location') 
     231        assert res.header('location')== '/login', res.header('location') 
    232232 
    233233        # authz test 
     
    235235        res = self.app.get(url_for(controller='check', action='get_auth_path')) 
    236236        assert res.status == 302, res.status 
    237         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     237        assert res.header('location')=='/security/failed', res.header('location') 
    238238 
    239239        self.login('root') 
  • branches/0.2.3.x/pysvnmanager/tests/functional/test_login.py

    r55 r100  
    3131        res = self.app.get(url_for(controller='security', action='submit'), params) 
    3232        self.assert_(res.status == 302) 
    33         self.assert_(res.all_headers('location') == ['http://localhost/'], res.all_headers('location')) 
     33        self.assert_(res.all_headers('location') == ['/'], res.all_headers('location')) 
    3434        self.assert_(res.session['user'] == 'root', res.session) 
    3535         
     
    5454        res = self.app.get(url_for(controller='security', action='logout')) 
    5555        self.assert_(res.status == 302) 
    56         self.assert_(res.all_headers('location') == ['http://localhost/login'], res.all_headers('location')) 
     56        self.assert_(res.all_headers('location') == ['/login'], res.all_headers('location')) 
    5757        self.assert_(res.session.get('user') == None, res.session.get('user')) 
  • branches/0.2.3.x/pysvnmanager/tests/functional/test_repos.py

    r55 r100  
    2626        res = self.app.get(url_for(controller='repos')) 
    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='repos')) 
    3333        assert res.status == 302, res.status 
    34         assert res.header('location')=='http://localhost/security/failed', res.header('location') 
     34        assert res.header('location')=='/security/failed', res.header('location') 
    3535         
    36         # Permission denied for repos admin(not root admin) 
     36        # repos admin can access repos controller(not root admin), but only with authed repos 
    3737        self.login('admin2') 
    3838        res = self.app.get(url_for(controller='repos')) 
    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 
     41        # ??? Repos admin can or can not manage hooks for his/her repos ??? 
     42        self.login('admin2') 
     43        res = self.app.get(url_for(controller='repos', action='init_repos_list')) 
     44        assert """id[0]="...";name[0]="Please choose..."; 
     45total=1;""" in res.body, res.body 
    4146 
    4247        # Login as superuser 
     
    5257        assert res.status == 200 
    5358        assert """id[0]="...";name[0]="Please choose..."; 
    54 id[1]="project1";name[1]="project1"; 
    55 id[2]="project2";name[2]="project2"; 
    56 id[3]="repos3";name[3]="repos3"; 
    57 total=4; 
    58 """ in res.body, res.body[:100] 
     59id[1]="repos3";name[1]="repos3"; 
     60id[2]="project1";name[2]="project1 (!)"; 
     61id[3]="project2";name[3]="project2 (!)"; 
     62total=4;""" in res.body, res.body[:200] 
    5963     
    6064    def test_get_plugin_list(self): 
  • 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