MCPcopy Create free account
hub / github.com/Pylons/webtest / test_upload_invalid_content

Method test_upload_invalid_content

tests/test_forms.py:1043–1055  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1041 self.assertRaises(ValueError, single_form.submit, "button")
1042
1043 def test_upload_invalid_content(self):
1044 app = webtest.TestApp(SingleUploadFileApp())
1045 res = app.get('/')
1046 single_form = res.forms["file_upload_form"]
1047 single_form.set("file-field", ('my_file.dat', 1))
1048 try:
1049 single_form.submit("button")
1050 except ValueError:
1051 e = sys.exc_info()[1]
1052 self.assertEqual(
1053 str(e),
1054 u('File content must be %s not %s' % (bytes, int))
1055 )
1056
1057 def test_invalid_uploadfiles(self):
1058 app = webtest.TestApp(SingleUploadFileApp())

Callers

nothing calls this directly

Calls 5

getMethod · 0.95
uFunction · 0.90
SingleUploadFileAppClass · 0.85
setMethod · 0.80
submitMethod · 0.80

Tested by

no test coverage detected