From: Brett Smith Date: Wed, 21 Mar 2012 03:03:11 +0000 (-0400) Subject: Make a function to generate test image filenames. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e75d4a0dd5895e7977812ed6a50df0ef24a97df0;p=mediagoblin.git Make a function to generate test image filenames. --- diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py index 18726b15..36a0debb 100644 --- a/mediagoblin/tests/test_submission.py +++ b/mediagoblin/tests/test_submission.py @@ -15,26 +15,24 @@ # along with this program. If not, see . import urlparse -import pkg_resources import re from nose.tools import assert_equal, assert_true, assert_false +from pkg_resources import resource_filename from mediagoblin.tests.tools import setup_fresh_app, get_test_app, \ fixture_add_user from mediagoblin import mg_globals from mediagoblin.tools import template, common -GOOD_JPG = pkg_resources.resource_filename( - 'mediagoblin.tests', 'test_submission/good.jpg') -GOOD_PNG = pkg_resources.resource_filename( - 'mediagoblin.tests', 'test_submission/good.png') -EVIL_FILE = pkg_resources.resource_filename( - 'mediagoblin.tests', 'test_submission/evil') -EVIL_JPG = pkg_resources.resource_filename( - 'mediagoblin.tests', 'test_submission/evil.jpg') -EVIL_PNG = pkg_resources.resource_filename( - 'mediagoblin.tests', 'test_submission/evil.png') +def resource(filename): + return resource_filename('mediagoblin.tests', 'test_submission/' + filename) + +GOOD_JPG = resource('good.jpg') +GOOD_PNG = resource('good.png') +EVIL_FILE = resource('evil') +EVIL_JPG = resource('evil.jpg') +EVIL_PNG = resource('evil.png') GOOD_TAG_STRING = 'yin,yang' BAD_TAG_STRING = 'rage,' + 'f' * 26 + 'u' * 26