from nose.tools import assert_equal
from mediagoblin.auth import lib as auth_lib
-from mediagoblin.tests.tools import get_test_app
+from mediagoblin.tests.tools import setup_fresh_app
from mediagoblin import globals as mgoblin_globals
from mediagoblin import util
'notthepassword', hashed_pw, '3><7R45417')
-def test_register_views():
+@setup_fresh_app
+def test_register_views(test_app):
"""
Massive test function that all our registration-related views all work.
"""
- util.clear_test_template_context()
- test_app = get_test_app()
-
# Test doing a simple GET on the page
# -----------------------------------
from paste.deploy import appconfig, loadapp
from webtest import TestApp
+from mediagoblin import util
+from mediagoblin.decorators import _make_safe
from mediagoblin.db.open import setup_connection_and_db_from_config
'config:' + TEST_APP_CONFIG)
return TestApp(test_app)
+
+
+def setup_fresh_app(func):
+ """
+ Decorator to setup a fresh test application for this function.
+
+ Cleans out test buckets and passes in a new, fresh test_app.
+ """
+ def wrapper(*args, **kwargs):
+ test_app = get_test_app()
+ util.clear_test_buckets()
+ return func(test_app, *args, **kwargs)
+
+ return _make_safe(wrapper, func)