Skip to content

Instantly share code, notes, and snippets.

@alfredo
Created November 30, 2011 14:01
Show Gist options
  • Save alfredo/1409156 to your computer and use it in GitHub Desktop.
Save alfredo/1409156 to your computer and use it in GitHub Desktop.
Create temporal file to test
from django.test import TestCase
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
class ToolsTest(TestCase):
def test_file(self):
"""Creates a tmp file"""
tmp_file = default_storage.save('tools/default.txt',
ContentFile('default content'))
default_storage.delete(tmp_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment