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