Changeset 103

Show
Ignore:
Timestamp:
2009年08月23日 18时14分31秒 (2 years ago)
Author:
jiangx
Message:

unittest works for python 0.9.7. Redirect location with prefix: http://localhost.

Location:
trunk/pysvnmanager/tests/functional
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/pysvnmanager/tests/functional/test_authz.py

    r102 r103  
    2525        res = self.app.get(url_for(controller='authz')) 
    2626        assert res.status == 302 
    27         self.assertEqual(res.header('location'), '/login') 
     27        assert res.header('location').endswith('/login'), res.header('location') 
    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'), '/security/failed', res.header('location')) 
     33        assert res.header('location').endswith('/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'), '/login') 
     53        assert res.header('location').endswith('/login'), res.header('location') 
    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')=='/security/failed', res.header('location') 
     59        assert res.header('location').endswith('/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'), '/login') 
     81        assert res.header('location').endswith('/login'), res.header('location') 
    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')=='/security/failed', res.header('location') 
     87        assert res.header('location').endswith('/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'), '/login') 
     122        assert res.header('location').endswith('/login'), res.header('location') 
    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')=='/security/failed', res.header('location') 
     128        assert res.header('location').endswith('/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'), '/login') 
     168            assert res.header('location').endswith('/login'), res.header('location') 
    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')=='/security/failed', res.header('location') 
     174            assert res.header('location').endswith('/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')== '/login', res.header('location') 
     336        assert res.header('location').endswith('/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')=='/security/failed', res.header('location') 
     342        assert res.header('location').endswith('/security/failed'), res.header('location') 
    343343 
    344344        authz = self.load_authz() 
  • trunk/pysvnmanager/tests/functional/test_check.py

    r102 r103  
    2626        res = self.app.get(url_for(controller='check')) 
    2727        assert res.status == 302 
    28         self.assertEqual(res.header('location'), '/login') 
     28        assert res.header('location').endswith('/login'), res.header('location') 
    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')=='/security/failed', res.header('location') 
     34        assert res.header('location').endswith('/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'), '/login') 
     58        assert res.header('location').endswith('/login'), res.header('location') 
    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')=='/security/failed', res.header('location') 
     64        assert res.header('location').endswith('/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')== '/login', res.header('location') 
     231        assert res.header('location').endswith('/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')=='/security/failed', res.header('location') 
     237        assert res.header('location').endswith('/security/failed'), res.header('location') 
    238238 
    239239        self.login('root') 
  • trunk/pysvnmanager/tests/functional/test_login.py

    r102 r103  
    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') == ['/'], res.all_headers('location')) 
     33        self.assert_(res.all_headers('location') == ['/'] or res.all_headers('location') == ['http://localhost/'], 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') == ['/login'], res.all_headers('location')) 
     56        self.assert_(res.all_headers('location') == ['/login'] or res.all_headers('location') == ['http://localhost/login'], res.all_headers('location')) 
    5757        self.assert_(res.session.get('user') == None, res.session.get('user')) 
  • trunk/pysvnmanager/tests/functional/test_repos.py

    r102 r103  
    2626        res = self.app.get(url_for(controller='repos')) 
    2727        assert res.status == 302 
    28         self.assertEqual(res.header('location'), '/login') 
     28        assert res.header('location').endswith('/login'), res.header('location') 
    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')=='/security/failed', res.header('location') 
     34        assert res.header('location').endswith('/security/failed'), res.header('location') 
    3535         
    3636        # repos admin can access repos controller(not root admin), but only with authed repos 
  • trunk/pysvnmanager/tests/functional/test_role.py

    r102 r103  
    2626        res = self.app.get(url_for(controller='role')) 
    2727        assert res.status == 302 
    28         self.assertEqual(res.header('location'), '/login') 
     28        assert res.header('location').endswith('/login'), res.header('location') 
    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')=='/security/failed', res.header('location') 
     34        assert res.header('location').endswith('/security/failed'), res.header('location') 
    3535         
    3636        # Repos admin(not root admin) can access role controller, but with disabled button. 
     
    5353        res = self.app.get(url_for(controller='role', action='get_role_info')) 
    5454        assert res.status == 302 
    55         self.assertEqual(res.header('location'), '/login') 
     55        assert res.header('location').endswith('/login'), res.header('location') 
    5656 
    5757        # authz test 
     
    5959        res = self.app.get(url_for(controller='role', action='get_role_info')) 
    6060        assert res.status == 302, res.status 
    61         assert res.header('location')=='/security/failed', res.header('location') 
     61        assert res.header('location').endswith('/security/failed'), res.header('location') 
    6262         
    6363        # Login as superuser 
     
    128128        res = self.app.get(url_for(controller='role', action='save_group')) 
    129129        assert res.status == 302 
    130         self.assertEqual(res.header('location'), '/login') 
     130        assert res.header('location').endswith('/login'), res.header('location') 
    131131 
    132132        # authz test 
     
    134134        res = self.app.get(url_for(controller='role', action='save_group')) 
    135135        assert res.status == 302, res.status 
    136         assert res.header('location')=='/security/failed', res.header('location') 
     136        assert res.header('location').endswith('/security/failed'), res.header('location') 
    137137 
    138138 
     
    213213        res = self.app.get(url_for(controller='role', action='delete_group')) 
    214214        assert res.status == 302 
    215         self.assertEqual(res.header('location'), '/login') 
     215        assert res.header('location').endswith('/login'), res.header('location') 
    216216 
    217217        # authz test 
     
    219219        res = self.app.get(url_for(controller='role', action='delete_group')) 
    220220        assert res.status == 302, res.status 
    221         assert res.header('location')=='/security/failed', res.header('location') 
     221        assert res.header('location').endswith('/security/failed'), res.header('location') 
    222222 
    223223        # Delete group failed, ref by other group. 
     
    275275        res = self.app.get(url_for(controller='role', action='save_alias')) 
    276276        assert res.status == 302 
    277         self.assertEqual(res.header('location'), '/login') 
     277        assert res.header('location').endswith('/login'), res.header('location') 
    278278 
    279279        # authz test 
     
    281281        res = self.app.get(url_for(controller='role', action='save_alias')) 
    282282        assert res.status == 302, res.status 
    283         assert res.header('location')=='/security/failed', res.header('location') 
     283        assert res.header('location').endswith('/security/failed'), res.header('location') 
    284284 
    285285        # Change alias successfully 
     
    352352        res = self.app.get(url_for(controller='role', action='delete_alias')) 
    353353        assert res.status == 302 
    354         self.assertEqual(res.header('location'), '/login') 
     354        assert res.header('location').endswith('/login'), res.header('location') 
    355355 
    356356        # authz test 
     
    358358        res = self.app.get(url_for(controller='role', action='delete_alias')) 
    359359        assert res.status == 302, res.status 
    360         assert res.header('location')=='/security/failed', res.header('location') 
     360        assert res.header('location').endswith('/security/failed'), res.header('location') 
    361361 
    362362        # Delete alias successfully