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

Method assertFile

tests/test_forms.py:909–924  ·  view source on GitHub ↗
(self, name, contents, display, content_type=None)

Source from the content-addressed store, hash-verified

907class TestFileUpload(unittest.TestCase):
908
909 def assertFile(self, name, contents, display, content_type=None):
910 if isinstance(name, bytes):
911 text_name = name.decode('ascii')
912 else:
913 text_name = name
914 self.assertIn("<p>You selected '" + text_name + "'</p>",
915 display, display)
916 if isinstance(contents, bytes):
917 text_contents = contents.decode('ascii')
918 else:
919 text_contents = contents
920 self.assertIn("<p>with contents: '" + text_contents + "'</p>",
921 display, display)
922 if content_type:
923 self.assertIn("<p>with content type: '" + content_type + "'</p>",
924 display, display)
925
926 def test_no_uploads_error(self):
927 app = webtest.TestApp(SingleUploadFileApp())

Calls

no outgoing calls

Tested by

no test coverage detected