New mediaentry slug tests now pass!

- fixed some issues with "whacking uuid junk on the slug"
 - uuid4() -> uuid.uuid4() so that mock will work right
 - added all the tests!
This commit is contained in:
Christopher Allan Webber
2013-01-23 16:49:54 -06:00
parent 394a4a37f7
commit a81082fcaf
2 changed files with 134 additions and 3 deletions

View File

@@ -27,7 +27,7 @@ These functions now live here and get "mixed in" into the
real objects.
"""
from uuid import uuid4
import uuid
from werkzeug.utils import cached_property
@@ -113,9 +113,10 @@ class MediaEntryMixin(object):
# okay, still no success;
# let's whack junk on there till it's unique.
self.slug += '-'
self.slug += '-' + uuid.uuid4().hex[:4]
# keep going if necessary!
while check_media_slug_used(self.uploader, self.slug, self.id):
self.slug += uuid4().hex[:4]
self.slug += uuid.uuid4().hex[:4]
@property
def description_html(self):