summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGael Pasgrimaud <gael@gawel.org>2013-02-22 18:30:39 +0100
committerGael Pasgrimaud <gael@gawel.org>2013-02-22 18:30:39 +0100
commit073e7c37e68e01f4e86268db4bf636509b0ecd8f (patch)
tree2ebf7057c97a5a903bd055387990ed0aa164d9f3 /tests
parentf7b1694dda1d6113a3356aaa7f0db9cf458b7ded (diff)
parentaaefa2ae9c49026ad434c7a19f53d834c817a226 (diff)
downloadwebtest-073e7c37e68e01f4e86268db4bf636509b0ecd8f.tar.gz
Merge branch 'master' of github.com:arthru/webtest
Diffstat (limited to 'tests')
-rw-r--r--tests/test_forms.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/test_forms.py b/tests/test_forms.py
index 0e7c441..c31a8fc 100644
--- a/tests/test_forms.py
+++ b/tests/test_forms.py
@@ -48,15 +48,21 @@ class TestForms(unittest.TestCase):
form['select'].force_value('notavalue')
form['select'].value__set('value3')
- assert form['select']._forced_value is NoValue
- assert form['select'].value == 'value3'
- assert form['select'].selectedIndex == 2
+ self.assertTrue(form['select']._forced_value is NoValue,
+ "Setting a value after having forced a value should keep a forced"
+ " state")
+ self.assertEqual(form['select'].value, 'value3',
+ "the value should the the one set by value__set")
+ self.assertEqual(form['select'].selectedIndex, 2,
+ "the value index should be the one set by value__set")
def test_form_select(self):
form = webtest.Form(None, PAGE_CONTENT)
form.select('select', 'value1')
- assert form['select'].value == 'value1'
+ self.assertEqual(form['select'].value, 'value1',
+ "when using form.select, the input selected value should be "
+ "changed")
def test_get_field_by_index(self):
form = webtest.Form(None, PAGE_CONTENT)
@@ -86,15 +92,14 @@ class TestForms(unittest.TestCase):
def no_form_app(environ, start_response):
status = b"200 OK"
- body = to_bytes(
-"""
+ body = to_bytes("""
<html>
<head><title>Page without form</title></head>
<body>
<h1>This is not the form you are looking for</h1>
</body>
</html>
-""" )
+""")
headers = [
('Content-Type', 'text/html; charset=utf-8'),
@@ -105,8 +110,7 @@ def no_form_app(environ, start_response):
def too_many_forms_app(environ, start_response):
status = b"200 OK"
- body = to_bytes(
-"""
+ body = to_bytes("""
<html>
<head><title>Page without form</title></head>
<body>
@@ -114,7 +118,7 @@ def too_many_forms_app(environ, start_response):
<form method="POST" id="second_form"></form>
</body>
</html>
-""" )
+""")
headers = [
('Content-Type', 'text/html; charset=utf-8'),