Changeset 100
- Timestamp:
- 2009年08月23日 17时21分57秒 (2 years ago)
- Location:
- branches/0.2.3.x/pysvnmanager/tests
- Files:
-
- 6 modified
-
__init__.py (modified) (1 diff)
-
functional/test_authz.py (modified) (12 diffs)
-
functional/test_check.py (modified) (6 diffs)
-
functional/test_login.py (modified) (2 diffs)
-
functional/test_repos.py (modified) (3 diffs)
-
functional/test_role.py (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.2.3.x/pysvnmanager/tests/__init__.py
r55 r100 60 60 def __init__(self, *args, **kwargs): 61 61 self.authz_file = os.path.dirname(__file__) + '/../../config/svn.access.test' 62 if pylons.test.pylonsapp:62 if hasattr(pylons.test, "pylonsapp"): 63 63 wsgiapp = pylons.test.pylonsapp 64 64 else: -
branches/0.2.3.x/pysvnmanager/tests/functional/test_authz.py
r55 r100 25 25 res = self.app.get(url_for(controller='authz')) 26 26 assert res.status == 302 27 self.assertEqual(res.header('location'), ' http://localhost/login')27 self.assertEqual(res.header('location'), '/login') 28 28 29 29 # Login as common user … … 31 31 res = self.app.get(url_for(controller='authz')) 32 32 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')) 34 34 35 35 # Login as repos admin … … 51 51 res = self.app.get(url_for(controller='authz', action='init_repos_list')) 52 52 assert res.status == 302 53 self.assertEqual(res.header('location'), ' http://localhost/login')53 self.assertEqual(res.header('location'), '/login') 54 54 55 55 # authz test … … 57 57 res = self.app.get(url_for(controller='authz', action='init_repos_list')) 58 58 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') 60 60 61 61 # Login as superuser … … 79 79 res = self.app.get(url_for(controller='authz', action='repos_changed')) 80 80 assert res.status == 302 81 self.assertEqual(res.header('location'), ' http://localhost/login')81 self.assertEqual(res.header('location'), '/login') 82 82 83 83 # authz test … … 85 85 res = self.app.get(url_for(controller='authz', action='repos_changed')) 86 86 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') 88 88 89 89 # Login as superuser … … 120 120 res = self.app.get(url_for(controller='authz', action='path_changed')) 121 121 assert res.status == 302 122 self.assertEqual(res.header('location'), ' http://localhost/login')122 self.assertEqual(res.header('location'), '/login') 123 123 124 124 # authz test … … 126 126 res = self.app.get(url_for(controller='authz', action='path_changed')) 127 127 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') 129 129 130 130 self.login('root') … … 166 166 res = self.app.get(url_for(controller='authz', action='save_authz')) 167 167 assert res.status == 302 168 self.assertEqual(res.header('location'), ' http://localhost/login')168 self.assertEqual(res.header('location'), '/login') 169 169 170 170 # authz test … … 172 172 res = self.app.get(url_for(controller='authz', action='save_authz')) 173 173 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') 175 175 176 176 # Login as superuser … … 334 334 res = self.app.get(url_for(controller='authz', action='delete_authz')) 335 335 assert res.status == 302 336 assert res.header('location')== ' http://localhost/login', res.header('location')336 assert res.header('location')== '/login', res.header('location') 337 337 338 338 # authz test … … 340 340 res = self.app.get(url_for(controller='authz', action='delete_authz')) 341 341 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') 343 343 344 344 authz = self.load_authz() -
branches/0.2.3.x/pysvnmanager/tests/functional/test_check.py
r55 r100 26 26 res = self.app.get(url_for(controller='check')) 27 27 assert res.status == 302 28 self.assertEqual(res.header('location'), ' http://localhost/login')28 self.assertEqual(res.header('location'), '/login') 29 29 30 30 # Login as common user … … 32 32 res = self.app.get(url_for(controller='check')) 33 33 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') 35 35 36 36 # Login as repos admin … … 56 56 res = self.app.get(url_for(controller='check', action='access_map')) 57 57 assert res.status == 302 58 self.assertEqual(res.header('location'), ' http://localhost/login')58 self.assertEqual(res.header('location'), '/login') 59 59 60 60 # authz test … … 62 62 res = self.app.get(url_for(controller='check', action='access_map')) 63 63 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') 65 65 66 66 # Login as superuser … … 229 229 res = self.app.get(url_for(controller='check', action='get_auth_path')) 230 230 assert res.status == 302 231 assert res.header('location')== ' http://localhost/login', res.header('location')231 assert res.header('location')== '/login', res.header('location') 232 232 233 233 # authz test … … 235 235 res = self.app.get(url_for(controller='check', action='get_auth_path')) 236 236 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') 238 238 239 239 self.login('root') -
branches/0.2.3.x/pysvnmanager/tests/functional/test_login.py
r55 r100 31 31 res = self.app.get(url_for(controller='security', action='submit'), params) 32 32 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')) 34 34 self.assert_(res.session['user'] == 'root', res.session) 35 35 … … 54 54 res = self.app.get(url_for(controller='security', action='logout')) 55 55 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')) 57 57 self.assert_(res.session.get('user') == None, res.session.get('user')) -
branches/0.2.3.x/pysvnmanager/tests/functional/test_repos.py
r55 r100 26 26 res = self.app.get(url_for(controller='repos')) 27 27 assert res.status == 302 28 self.assertEqual(res.header('location'), ' http://localhost/login')28 self.assertEqual(res.header('location'), '/login') 29 29 30 30 # Login as common user … … 32 32 res = self.app.get(url_for(controller='repos')) 33 33 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') 35 35 36 # Permission denied for repos admin(not root admin)36 # repos admin can access repos controller(not root admin), but only with authed repos 37 37 self.login('admin2') 38 38 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..."; 45 total=1;""" in res.body, res.body 41 46 42 47 # Login as superuser … … 52 57 assert res.status == 200 53 58 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] 59 id[1]="repos3";name[1]="repos3"; 60 id[2]="project1";name[2]="project1 (!)"; 61 id[3]="project2";name[3]="project2 (!)"; 62 total=4;""" in res.body, res.body[:200] 59 63 60 64 def test_get_plugin_list(self): -
branches/0.2.3.x/pysvnmanager/tests/functional/test_role.py
r55 r100 26 26 res = self.app.get(url_for(controller='role')) 27 27 assert res.status == 302 28 self.assertEqual(res.header('location'), ' http://localhost/login')28 self.assertEqual(res.header('location'), '/login') 29 29 30 30 # Login as common user … … 32 32 res = self.app.get(url_for(controller='role')) 33 33 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. 37 37 self.login('admin2') 38 38 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:] 41 44 42 45 # Login as superuser … … 50 53 res = self.app.get(url_for(controller='role', action='get_role_info')) 51 54 assert res.status == 302 52 self.assertEqual(res.header('location'), ' http://localhost/login')55 self.assertEqual(res.header('location'), '/login') 53 56 54 57 # authz test … … 56 59 res = self.app.get(url_for(controller='role', action='get_role_info')) 57 60 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') 59 62 60 63 # Login as superuser … … 125 128 res = self.app.get(url_for(controller='role', action='save_group')) 126 129 assert res.status == 302 127 self.assertEqual(res.header('location'), ' http://localhost/login')130 self.assertEqual(res.header('location'), '/login') 128 131 129 132 # authz test … … 131 134 res = self.app.get(url_for(controller='role', action='save_group')) 132 135 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 134 138 135 139 # Change group members, autodrop=no … … 209 213 res = self.app.get(url_for(controller='role', action='delete_group')) 210 214 assert res.status == 302 211 self.assertEqual(res.header('location'), ' http://localhost/login')215 self.assertEqual(res.header('location'), '/login') 212 216 213 217 # authz test … … 215 219 res = self.app.get(url_for(controller='role', action='delete_group')) 216 220 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') 218 222 219 223 # Delete group failed, ref by other group. … … 271 275 res = self.app.get(url_for(controller='role', action='save_alias')) 272 276 assert res.status == 302 273 self.assertEqual(res.header('location'), ' http://localhost/login')277 self.assertEqual(res.header('location'), '/login') 274 278 275 279 # authz test … … 277 281 res = self.app.get(url_for(controller='role', action='save_alias')) 278 282 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') 280 284 281 285 # Change alias successfully … … 348 352 res = self.app.get(url_for(controller='role', action='delete_alias')) 349 353 assert res.status == 302 350 self.assertEqual(res.header('location'), ' http://localhost/login')354 self.assertEqual(res.header('location'), '/login') 351 355 352 356 # authz test … … 354 358 res = self.app.get(url_for(controller='role', action='delete_alias')) 355 359 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') 357 361 358 362 # Delete alias successfully
![(please configure the [header_logo] section in trac.ini)](/trac/pysvnmanager/chrome/common/trac_banner.png)