def test__using_with__no_params(self):
        with Temp_File() as temp:
            assert Files.file_extension(temp.file_path) == '.tmp'
            assert Files.exists(temp.file_path)
            assert Files.contents(temp.file_path) == '...'
        assert Files.not_exists(temp.file_path)

        with Temp_File('abc', 'txt') as temp:
            assert Files.file_extension(temp.file_path) == '.txt'
            assert Files.exists(temp.file_path)
            assert Files.contents(temp.file_path) == 'abc'
        assert Files.not_exists(temp.file_path)
Exemplo n.º 2
0
 def file_upload_as_temp_file(self, file, bucket):
     key = '{0}/{1}'.format(self.tmp_file_folder,
                            Files.temp_filename(Files.file_extension(file)))
     self.file_upload_to_key(file, bucket, key)
     return key