Adding a docstring to fixture_media_entry
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 22 Jun 2013 22:40:12 +0000 (17:40 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 22 Jun 2013 22:40:12 +0000 (17:40 -0500)
It's not complete, but it makes clearer how to avoid errors with
fake_upload :)

This commit sponsored by Harper Sanford.  Thank you!

mediagoblin/tests/tools.py

index 836072b3f64cf18e91a6f0af422630010a04c8ac..222649f1df5e0b9fe9f32b82c8a80dea9bab90ac 100644 (file)
@@ -234,6 +234,14 @@ def fixture_media_entry(title=u"Some title", slug=None,
                         uploader=None, save=True, gen_slug=True,
                         state=u'unprocessed', fake_upload=True,
                         expunge=True):
+    """
+    Add a media entry for testing purposes.
+
+    Caution: if you're adding multiple entries with fake_upload=True,
+    make sure you save between them... otherwise you'll hit an
+    IntegrityError from multiple newly-added-MediaEntries adding
+    FileKeynames at once.  :)
+    """
     if uploader is None:
         uploader = fixture_add_user().id