Hi Lisa, Thanks for the reply.
On Wed, 17 Sep 2008 14:28:59 -0700, Lisa Dusseault <[EMAIL PROTECTED]> wrote: > ------=_Part_17268_18727299.1221686939556 > Content-Type: text/plain; charset=ISO-8859-1 > > I have a bunch of unit tests that do file upload too. E.g.: > > def testBasics(self): > testpage = self.test_report.page_set.create(slug="testpage", title = > "Test Page") > self.assertEquals(testpage.report, self.test_report) > testpage.page_spec.save("testgraphspec.json", > ContentFile(TESTSPECSTR)) > graphspecs = testpage.graphspecs() > assert "age1" in graphspecs.keys() > self.assertEquals(graphspecs["age1"].slug, "age1") > I have no idea if this is the best way or not, but it seems that the > django unit test magic does the right thing here, and the file that > is created upon upload gets cleaned up afterward, without any need > to change the MEDIA location or do other painful things. Well, hopefully it doesn't need to be that painful. :-) I'm surprised the files get removed automatically, if that's what you mean. You are not deleting them after the tests are run? One reason I don't want the test files uploaded to the same directory as the regular files is that I check to see whether the files uploaded to the location are the correct ones, which is impossible if there are other files there already. In general it is just cleaner, I think. > Are you using django's "manage.py test" to run the tests? Yes. Faheem. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---