Test that validaton is happening correctly with correct data.

pull/7/head
Ferry Boender 10 years ago
parent dc7e2669ce
commit 63c3a4d594
  1. 26
      test/test.py

@ -9,6 +9,7 @@ import thread
import time
import requests
import StringIO
import re
base_config = {
"title": "test",
@ -280,6 +281,31 @@ class WebAppTest(unittest.TestCase):
self.assertIn('This form is heavily validated', r.text)
self.assertIn('name="string"', r.text)
def testValidateCorrectData(self):
data = {
"form_name": 'validate',
"string": "12345",
"integer": "12",
"float": "0.6",
"date": "2015-01-02",
"text": "1234567890",
"password": "12345",
"radio": "One"
}
import random
f = file('data.csv', 'w')
for i in range(1024):
f.write(chr(random.randint(0, 255)))
f.close()
files = {'file': open('data.csv', 'rb')}
r = requests.post("http://localhost:8002/submit", data=data, files=files, auth=self.auth_user)
r_error = '<span class="error">(.*)</span>'
for match in re.findall(r_error, r.text):
self.assertEquals(match, u'')
def testOutputEscaped(self):
"""Form with 'escaped' output should have HTML entities escaped"""
data = {

Loading…
Cancel
Save