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')
def test_wrong_filepath(self): f = File() f.path = '/non-exist-file' f.make_tuple()
def test_wrong_filepath_constructor(self): f = File(filepath='/non-exist-file') f.make_tuple()
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')]
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 []
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') ]