Kind of a dorky way to implement this, but...
from .resources import GOOD_JPG, GOOD_PNG, EVIL_FILE, EVIL_JPG, EVIL_PNG, \
BIG_BLUE
+from mediagoblin.tools.testing import _activate_testing
+_activate_testing()
+
_log = logging.getLogger(__name__)
from mediagoblin.tools import template, mail
+from mediagoblin.tools.testing import _activate_testing
+_activate_testing()
+
+
########################
# Test bcrypt auth funcs
########################
from mediagoblin.init.config import read_mediagoblin_config
+from mediagoblin.tools.testing import _activate_testing
+_activate_testing()
+
+
+
TEST_CELERY_CONF_NOSPECIALDB = pkg_resources.resource_filename(
'mediagoblin.tests', 'fake_celery_conf.ini')
from mediagoblin.tests.tools import fixture_add_collection, fixture_add_user
from mediagoblin.db.models import Collection, User
+from mediagoblin.tools.testing import _activate_testing
+_activate_testing()
+
def test_user_deletes_collection(test_app):
# Setup db.
import pkg_resources
from mediagoblin.init import config
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
CARROT_CONF_GOOD = pkg_resources.resource_filename(
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin import mg_globals
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
def test_csrf_cookie_set(test_app):
from mediagoblin.tests.tools import fixture_add_user
from mediagoblin.tools import template
from mediagoblin.auth.lib import bcrypt_check_password
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
class TestUserEdit(object):
def setup(self):
from mediagoblin.tools.exif import exif_fix_image_orientation, \
extract_exif, clean_exif, get_gps_data, get_useful
from .resources import GOOD_JPG, EMPTY_JPG, BAD_JPG, GPS_JPG
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
def assert_in(a, b):
import pytest
from mediagoblin import mg_globals
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
class TestGlobals(object):
from mediagoblin.tests.tools import fixture_add_user
from mediagoblin.tests.test_submission import GOOD_PNG
from mediagoblin.tests import test_oauth as oauth
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
class TestHTTPCallback(object):
from mediagoblin import messages
from mediagoblin.tools import template
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
def test_messages(test_app):
from mediagoblin.db.base import Session
from mediagoblin.db.models import User, MediaEntry, MediaComment
from mediagoblin.tests.tools import fixture_add_user, fixture_media_entry
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
def test_404_for_non_existent(test_app):
# Maybe not every model needs a test, but some models have special
# methods, and so it makes sense to test them here.
+import mock
+
from mediagoblin.db.base import Session
from mediagoblin.db.models import MediaEntry
from mediagoblin.tests.tools import fixture_add_user
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
-import mock
class FakeUUID(object):
from mediagoblin import mg_globals
from mediagoblin.tools import template, pluginapi
from mediagoblin.tests.tools import fixture_add_user
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
_log = logging.getLogger(__name__)
from mediagoblin.media_types.pdf.processing import (
pdf_info, check_prerequisites, create_pdf_thumb)
from .resources import GOOD_PDF as GOOD
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
@pytest.mark.skipif("not check_prerequisites()")
import pytest
from .tools import fixture_add_user
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
XML_PREFIX = "<?xml version='1.0' encoding='utf-8'?>\n"
from mediagoblin.init.config import read_mediagoblin_config
from mediagoblin.tools import pluginapi
from mediagoblin.tests.tools import get_app
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
def with_cleanup(*modules_to_delete):
#!/usr/bin/env python
from mediagoblin import processing
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
+
class TestProcessing(object):
def run_fill(self, input, format, output=None):
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin.tools import session
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
+
def test_session():
sess = session.Session()
from mediagoblin.db.base import GMGTableBase
from mediagoblin.db.migration_tools import MigrationManager, RegisterMigration
from mediagoblin.tools.common import CollectingPrinter
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
# This one will get filled with local migrations
from mediagoblin.tools import staticdirect
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
+
def test_staticdirect():
sdirect = staticdirect.StaticDirect(
from werkzeug.utils import secure_filename
from mediagoblin import storage
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
################
from mediagoblin.tools import template
from mediagoblin.media_types.image import MEDIA_MANAGER as img_MEDIA_MANAGER
from mediagoblin.media_types.pdf.processing import check_prerequisites as pdf_check_prerequisites
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
+
from .resources import GOOD_JPG, GOOD_PNG, EVIL_FILE, EVIL_JPG, EVIL_PNG, \
BIG_BLUE, GOOD_PDF, GPS_JPG
+
GOOD_TAG_STRING = u'yin,yang'
BAD_TAG_STRING = unicode('rage,' + 'f' * 26 + 'u' * 26)
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin.tools import text
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
+
def test_list_of_dicts_conversion(test_app):
"""
from datetime import datetime, timedelta
from mediagoblin.tools.timesince import is_aware, timesince
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
def test_timesince():
from mediagoblin.mg_globals import setup_globals
from mediagoblin.decorators import get_workbench
from mediagoblin.tests.test_storage import get_tmp_filestorage, cleanup_storage
+from mediagoblin.tools.testing import _activate_testing
+
+_activate_testing()
class TestWorkbench(object):