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

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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