示例#1
0
 def test_file_resolve_path(self):
     f = File(filepath='~/Desktop/../Lenna.png')
     self.assertEqual(f.path, path.expanduser('~/Lenna.png'))
     f.path = '~/test'
     self.assertEqual(f.path, path.expanduser('~/test'))
     f.path = '../../testdata/Lenna.png'
     self.assertEqual(f.path, '../../testdata/Lenna.png')
示例#2
0
 def test_wrong_filepath(self):
     f = File()
     f.path = '/non-exist-file'
     f.make_tuple()
示例#3
0
 def test_wrong_filepath_constructor(self):
     f = File(filepath='/non-exist-file')
     f.make_tuple()
示例#4
0
 def test_make_tuple(self):
     f = File(filepath=path.join(testdatadir, 'Lenna.png'))
     f.make_tuple()
 def make_files(self):
     """ Create and return Array of File objects of the Request. """
     return [File(self.fname, postfield='file')]
示例#6
0
 def make_files(self):
     """ Create and return Array of File objects of the Request. """
     # Check if attachment file has been defined as it is optional
     if self.attach_file != '':
         return [File(self.attach_file, 'file')]
     return []
示例#7
0
 def make_files(self):
     """ Create and return Array of File objects of the Request. """
     return [
         File(self.png_file, 'png_file'),
         File(self.yaml_file, 'yaml_file')
     ]