From 0536306048daa0970d2e43411ba2a9bf073e570e Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 16 May 2013 17:51:21 -0500 Subject: [PATCH] Always activate testing in every test module ever. Kind of a dorky way to implement this, but... --- mediagoblin/tests/test_api.py | 3 +++ mediagoblin/tests/test_auth.py | 4 ++++ mediagoblin/tests/test_celery_setup.py | 5 +++++ mediagoblin/tests/test_collections.py | 3 +++ mediagoblin/tests/test_config.py | 3 +++ mediagoblin/tests/test_csrf_middleware.py | 3 +++ mediagoblin/tests/test_edit.py | 3 +++ mediagoblin/tests/test_exif.py | 3 +++ mediagoblin/tests/test_globals.py | 3 +++ mediagoblin/tests/test_http_callback.py | 3 +++ mediagoblin/tests/test_messages.py | 3 +++ mediagoblin/tests/test_misc.py | 3 +++ mediagoblin/tests/test_modelmethods.py | 6 +++++- mediagoblin/tests/test_oauth.py | 3 +++ mediagoblin/tests/test_pdf.py | 3 +++ mediagoblin/tests/test_piwigo.py | 3 +++ mediagoblin/tests/test_pluginapi.py | 3 +++ mediagoblin/tests/test_processing.py | 4 ++++ mediagoblin/tests/test_session.py | 4 ++++ mediagoblin/tests/test_sql_migrations.py | 3 +++ mediagoblin/tests/test_staticdirect.py | 4 ++++ mediagoblin/tests/test_storage.py | 3 +++ mediagoblin/tests/test_submission.py | 5 +++++ mediagoblin/tests/test_tags.py | 4 ++++ mediagoblin/tests/test_timesince.py | 3 +++ mediagoblin/tests/test_workbench.py | 3 +++ 26 files changed, 89 insertions(+), 1 deletion(-) diff --git a/mediagoblin/tests/test_api.py b/mediagoblin/tests/test_api.py index 89cf1026..00cdb137 100644 --- a/mediagoblin/tests/test_api.py +++ b/mediagoblin/tests/test_api.py @@ -26,6 +26,9 @@ from mediagoblin.tests.tools import fixture_add_user 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__) diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py index 755727f9..28153677 100644 --- a/mediagoblin/tests/test_auth.py +++ b/mediagoblin/tests/test_auth.py @@ -24,6 +24,10 @@ from mediagoblin.tests.tools import fixture_add_user from mediagoblin.tools import template, mail +from mediagoblin.tools.testing import _activate_testing +_activate_testing() + + ######################## # Test bcrypt auth funcs ######################## diff --git a/mediagoblin/tests/test_celery_setup.py b/mediagoblin/tests/test_celery_setup.py index 5530c6f2..431d69c5 100644 --- a/mediagoblin/tests/test_celery_setup.py +++ b/mediagoblin/tests/test_celery_setup.py @@ -20,6 +20,11 @@ from mediagoblin.init import celery as celery_setup 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') diff --git a/mediagoblin/tests/test_collections.py b/mediagoblin/tests/test_collections.py index 87782f30..42f0cc4c 100644 --- a/mediagoblin/tests/test_collections.py +++ b/mediagoblin/tests/test_collections.py @@ -17,6 +17,9 @@ 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. diff --git a/mediagoblin/tests/test_config.py b/mediagoblin/tests/test_config.py index b13adae6..e84481f0 100644 --- a/mediagoblin/tests/test_config.py +++ b/mediagoblin/tests/test_config.py @@ -17,6 +17,9 @@ import pkg_resources from mediagoblin.init import config +from mediagoblin.tools.testing import _activate_testing + +_activate_testing() CARROT_CONF_GOOD = pkg_resources.resource_filename( diff --git a/mediagoblin/tests/test_csrf_middleware.py b/mediagoblin/tests/test_csrf_middleware.py index a272caf6..f63c75c4 100644 --- a/mediagoblin/tests/test_csrf_middleware.py +++ b/mediagoblin/tests/test_csrf_middleware.py @@ -15,6 +15,9 @@ # along with this program. If not, see . from mediagoblin import mg_globals +from mediagoblin.tools.testing import _activate_testing + +_activate_testing() def test_csrf_cookie_set(test_app): diff --git a/mediagoblin/tests/test_edit.py b/mediagoblin/tests/test_edit.py index cda2607f..06cf3db0 100644 --- a/mediagoblin/tests/test_edit.py +++ b/mediagoblin/tests/test_edit.py @@ -21,6 +21,9 @@ from mediagoblin.db.models import User 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): diff --git a/mediagoblin/tests/test_exif.py b/mediagoblin/tests/test_exif.py index 824de3c2..4d8eae49 100644 --- a/mediagoblin/tests/test_exif.py +++ b/mediagoblin/tests/test_exif.py @@ -23,6 +23,9 @@ except ImportError: 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): diff --git a/mediagoblin/tests/test_globals.py b/mediagoblin/tests/test_globals.py index fe3088f8..dafd71db 100644 --- a/mediagoblin/tests/test_globals.py +++ b/mediagoblin/tests/test_globals.py @@ -17,6 +17,9 @@ import pytest from mediagoblin import mg_globals +from mediagoblin.tools.testing import _activate_testing + +_activate_testing() class TestGlobals(object): diff --git a/mediagoblin/tests/test_http_callback.py b/mediagoblin/tests/test_http_callback.py index a0511af7..43b21140 100644 --- a/mediagoblin/tests/test_http_callback.py +++ b/mediagoblin/tests/test_http_callback.py @@ -24,6 +24,9 @@ from mediagoblin.tools import processing 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): diff --git a/mediagoblin/tests/test_messages.py b/mediagoblin/tests/test_messages.py index 22f9e800..e07d88d4 100644 --- a/mediagoblin/tests/test_messages.py +++ b/mediagoblin/tests/test_messages.py @@ -16,6 +16,9 @@ from mediagoblin import messages from mediagoblin.tools import template +from mediagoblin.tools.testing import _activate_testing + +_activate_testing() def test_messages(test_app): diff --git a/mediagoblin/tests/test_misc.py b/mediagoblin/tests/test_misc.py index 755d863f..a16ab61d 100644 --- a/mediagoblin/tests/test_misc.py +++ b/mediagoblin/tests/test_misc.py @@ -17,6 +17,9 @@ 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): diff --git a/mediagoblin/tests/test_modelmethods.py b/mediagoblin/tests/test_modelmethods.py index 427aa47c..970587e2 100644 --- a/mediagoblin/tests/test_modelmethods.py +++ b/mediagoblin/tests/test_modelmethods.py @@ -17,12 +17,16 @@ # 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): diff --git a/mediagoblin/tests/test_oauth.py b/mediagoblin/tests/test_oauth.py index ea3bd798..2e73c9a5 100644 --- a/mediagoblin/tests/test_oauth.py +++ b/mediagoblin/tests/test_oauth.py @@ -23,6 +23,9 @@ from urlparse import parse_qs, urlparse 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__) diff --git a/mediagoblin/tests/test_pdf.py b/mediagoblin/tests/test_pdf.py index b4d1940a..e86409fe 100644 --- a/mediagoblin/tests/test_pdf.py +++ b/mediagoblin/tests/test_pdf.py @@ -22,6 +22,9 @@ import pytest 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()") diff --git a/mediagoblin/tests/test_piwigo.py b/mediagoblin/tests/test_piwigo.py index 18f95057..4d0ea885 100644 --- a/mediagoblin/tests/test_piwigo.py +++ b/mediagoblin/tests/test_piwigo.py @@ -16,6 +16,9 @@ import pytest from .tools import fixture_add_user +from mediagoblin.tools.testing import _activate_testing + +_activate_testing() XML_PREFIX = "\n" diff --git a/mediagoblin/tests/test_pluginapi.py b/mediagoblin/tests/test_pluginapi.py index 73ad235e..c4e6d6e8 100644 --- a/mediagoblin/tests/test_pluginapi.py +++ b/mediagoblin/tests/test_pluginapi.py @@ -26,6 +26,9 @@ from mediagoblin.init.plugins import setup_plugins 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): diff --git a/mediagoblin/tests/test_processing.py b/mediagoblin/tests/test_processing.py index 591add96..493aa77b 100644 --- a/mediagoblin/tests/test_processing.py +++ b/mediagoblin/tests/test_processing.py @@ -1,6 +1,10 @@ #!/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): diff --git a/mediagoblin/tests/test_session.py b/mediagoblin/tests/test_session.py index 78d790eb..b8ea4150 100644 --- a/mediagoblin/tests/test_session.py +++ b/mediagoblin/tests/test_session.py @@ -15,6 +15,10 @@ # along with this program. If not, see . from mediagoblin.tools import session +from mediagoblin.tools.testing import _activate_testing + +_activate_testing() + def test_session(): sess = session.Session() diff --git a/mediagoblin/tests/test_sql_migrations.py b/mediagoblin/tests/test_sql_migrations.py index 2fc4c043..ff3d384f 100644 --- a/mediagoblin/tests/test_sql_migrations.py +++ b/mediagoblin/tests/test_sql_migrations.py @@ -28,6 +28,9 @@ from migrate import changeset 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 diff --git a/mediagoblin/tests/test_staticdirect.py b/mediagoblin/tests/test_staticdirect.py index 3a9e2fd9..663ab68e 100644 --- a/mediagoblin/tests/test_staticdirect.py +++ b/mediagoblin/tests/test_staticdirect.py @@ -1,4 +1,8 @@ from mediagoblin.tools import staticdirect +from mediagoblin.tools.testing import _activate_testing + +_activate_testing() + def test_staticdirect(): sdirect = staticdirect.StaticDirect( diff --git a/mediagoblin/tests/test_storage.py b/mediagoblin/tests/test_storage.py index f6f1d18f..e5bc00de 100644 --- a/mediagoblin/tests/test_storage.py +++ b/mediagoblin/tests/test_storage.py @@ -22,6 +22,9 @@ import pytest from werkzeug.utils import secure_filename from mediagoblin import storage +from mediagoblin.tools.testing import _activate_testing + +_activate_testing() ################ diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py index 162b2d19..69f867c0 100644 --- a/mediagoblin/tests/test_submission.py +++ b/mediagoblin/tests/test_submission.py @@ -28,10 +28,15 @@ from mediagoblin.db.models import MediaEntry 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) diff --git a/mediagoblin/tests/test_tags.py b/mediagoblin/tests/test_tags.py index e25cc283..8e137b06 100644 --- a/mediagoblin/tests/test_tags.py +++ b/mediagoblin/tests/test_tags.py @@ -15,6 +15,10 @@ # along with this program. If not, see . from mediagoblin.tools import text +from mediagoblin.tools.testing import _activate_testing + +_activate_testing() + def test_list_of_dicts_conversion(test_app): """ diff --git a/mediagoblin/tests/test_timesince.py b/mediagoblin/tests/test_timesince.py index 6579eb09..0a25613a 100644 --- a/mediagoblin/tests/test_timesince.py +++ b/mediagoblin/tests/test_timesince.py @@ -17,6 +17,9 @@ 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(): diff --git a/mediagoblin/tests/test_workbench.py b/mediagoblin/tests/test_workbench.py index 6695618b..b9e99cbe 100644 --- a/mediagoblin/tests/test_workbench.py +++ b/mediagoblin/tests/test_workbench.py @@ -22,6 +22,9 @@ from mediagoblin.tools import workbench 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): -- 2.25.1