Skip to content

Commit

Permalink
[#1025] Fix failing tests due to extra redirect etc (stupid tests)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Jun 19, 2013
1 parent 82952b0 commit c2f2707
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ckan/tests/functional/test_user.py
Expand Up @@ -99,9 +99,10 @@ def test_user_login_page(self):
assert 'Don\'t have an OpenID' in res, res

def test_logout(self):
res = self.app.get('/user/logout')
res = self.app.get('/user/_logout')
res2 = res.follow()
res2 = res2.follow()
while res2.status == 302:
res2 = res2.follow()
assert 'You have logged out successfully.' in res2, res2

def _get_cookie_headers(self, res):
Expand Down Expand Up @@ -142,6 +143,7 @@ def test_login(self):

# then get redirected to user's dashboard
res = res.follow()
res = res.follow()
assert_equal(res.status, 302)
assert res.header('Location').startswith('http://localhost/dashboard') or \
res.header('Location').startswith('/dashboard')
Expand Down Expand Up @@ -214,6 +216,7 @@ def test_login_wrong_password(self):

# then get redirected to login
res = res.follow()
res = res.follow()
assert_equal(res.status, 302)
assert res.header('Location').startswith('http://localhost/user/login') or \
res.header('Location').startswith('/user/login')
Expand Down Expand Up @@ -336,9 +339,10 @@ def test_register_whilst_logged_in(self):
assert 'logout' in res.body, res.body

# logout and login as user B
res = self.app.get('/user/logout')
res = self.app.get('/user/_logout')
res2 = res.follow()
res2 = res2.follow()
while res2.status == 302:
res2 = res2.follow()
assert 'You have logged out successfully.' in res2, res2
offset = url_for(controller='user', action='login')
res = self.app.get(offset)
Expand Down

0 comments on commit c2f2707

Please sign in to comment.