Merge pull request #9 from Widdershin/master

Webtests now correctly follow responses
master
Steven Loria 11 years ago
commit 6a4321b9c4
  1. 8
      {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/tests/webtest_tests.py

@ -27,7 +27,7 @@ class TestLoggingIn(DbTestCase):
form['username'] = self.user.username form['username'] = self.user.username
form['password'] = 'myprecious' form['password'] = 'myprecious'
# Submits # Submits
res = form.submit().maybe_follow() res = form.submit().follow()
assert_equal(res.status_code, 200) assert_equal(res.status_code, 200)
def _login(self, username, password): def _login(self, username, password):
@ -37,12 +37,12 @@ class TestLoggingIn(DbTestCase):
form['username'] = username form['username'] = username
form['password'] = password form['password'] = password
# Submits # Submits
res = form.submit().maybe_follow() res = form.submit().follow()
return res return res
def test_sees_alert_on_log_out(self): def test_sees_alert_on_log_out(self):
res = self._login(self.user.username, 'myprecious') res = self._login(self.user.username, 'myprecious')
res = self.w.get(url_for('public.logout')).maybe_follow() res = self.w.get(url_for('public.logout')).follow()
# sees alert # sees alert
assert_in('You are logged out.', res) assert_in('You are logged out.', res)
@ -88,7 +88,7 @@ class TestRegistering(DbTestCase):
form['password'] = 'secret' form['password'] = 'secret'
form['confirm'] = 'secret' form['confirm'] = 'secret'
# Submits # Submits
res = form.submit().maybe_follow() res = form.submit().follow()
assert_equal(res.status_code, 200) assert_equal(res.status_code, 200)
# A new user was created # A new user was created
assert_equal(len(User.query.all()), 1) assert_equal(len(User.query.all()), 1)

Loading…
Cancel
Save