diff --git a/tests/__init__.py b/tests/__init__.py
index 6d1f451..53e0d9b 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -5,20 +5,24 @@ from tests.test_app.sqlalchemy import create_app
class SecurityTest(TestCase):
+ APP_KWARGS = {
+ 'register_blueprint': True,
+ }
AUTH_CONFIG = None
def setUp(self):
super(SecurityTest, self).setUp()
- app = self._create_app(self.AUTH_CONFIG or {})
+ app_kwargs = self.APP_KWARGS
+ app = self._create_app(self.AUTH_CONFIG or {}, **app_kwargs)
app.debug = False
app.config['TESTING'] = True
self.app = app
self.client = app.test_client()
- def _create_app(self, auth_config, register_blueprint=True):
- return create_app(auth_config, register_blueprint)
+ def _create_app(self, auth_config, **kwargs):
+ return create_app(auth_config, **kwargs)
def _get(self, route, content_type=None, follow_redirects=None, headers=None):
return self.client.get(route, follow_redirects=follow_redirects,
diff --git a/tests/configured_tests.py b/tests/configured_tests.py
index 45f0fc6..0c6b11d 100644
--- a/tests/configured_tests.py
+++ b/tests/configured_tests.py
@@ -468,13 +468,14 @@ class AsyncMailTaskTests(SecurityTest):
class NoBlueprintTests(SecurityTest):
+ APP_KWARGS = {
+ 'register_blueprint': False,
+ }
+
AUTH_CONFIG = {
'USER_COUNT': 1
}
- def _create_app(self, auth_config):
- return super(NoBlueprintTests, self)._create_app(auth_config, False)
-
def test_login_endpoint_is_404(self):
r = self._get('/login')
self.assertEqual(404, r.status_code)
@@ -483,3 +484,18 @@ class NoBlueprintTests(SecurityTest):
auth = 'Basic ' + base64.b64encode("matt@lp.com:password")
r = self._get('/http', headers={'Authorization': auth})
self.assertIn('HTTP Authentication', r.data)
+
+
+class ExtendFormsTest(SecurityTest):
+
+ APP_KWARGS = {
+ }
+
+ AUTH_CONFIG = {
+ 'SECURITY_REGISTERABLE': True,
+ }
+
+ def test_register(self):
+ r = self._get('/register')
+ self.assertIn('
Register
', r.data)
+
diff --git a/tests/functional_tests.py b/tests/functional_tests.py
index c9fd8da..49e9be6 100644
--- a/tests/functional_tests.py
+++ b/tests/functional_tests.py
@@ -201,9 +201,9 @@ class DefaultSecurityTests(SecurityTest):
class MongoEngineSecurityTests(DefaultSecurityTests):
- def _create_app(self, auth_config):
+ def _create_app(self, auth_config, **kwargs):
from tests.test_app.mongoengine import create_app
- return create_app(auth_config)
+ return create_app(auth_config, **kwargs)
class DefaultDatastoreTests(SecurityTest):
@@ -231,6 +231,6 @@ class DefaultDatastoreTests(SecurityTest):
class MongoEngineDatastoreTests(DefaultDatastoreTests):
- def _create_app(self, auth_config):
+ def _create_app(self, auth_config, **kwargs):
from tests.test_app.mongoengine import create_app
- return create_app(auth_config)
+ return create_app(auth_config, **kwargs)
diff --git a/tests/test_app/mongoengine.py b/tests/test_app/mongoengine.py
index 52377f2..d40f666 100644
--- a/tests/test_app/mongoengine.py
+++ b/tests/test_app/mongoengine.py
@@ -13,7 +13,7 @@ from flask.ext.security import Security, UserMixin, RoleMixin, \
from tests.test_app import create_app as create_base_app, populate_data, \
add_context_processors
-def create_app(config):
+def create_app(config, **kwargs):
app = create_base_app(config)
app.config['MONGODB_SETTINGS'] = dict(
@@ -46,7 +46,7 @@ def create_app(config):
Role.drop_collection()
populate_data(app.config.get('USER_COUNT', None))
- app.security = Security(app, MongoEngineUserDatastore(db, User, Role))
+ app.security = Security(app, datastore=MongoEngineUserDatastore(db, User, Role), **kwargs)
add_context_processors(app.security)
diff --git a/tests/test_app/sqlalchemy.py b/tests/test_app/sqlalchemy.py
index 0cf2e9c..ec23b01 100644
--- a/tests/test_app/sqlalchemy.py
+++ b/tests/test_app/sqlalchemy.py
@@ -14,10 +14,11 @@ from flask.ext.security import Security, UserMixin, RoleMixin, \
from tests.test_app import create_app as create_base_app, populate_data, \
add_context_processors
-def create_app(config, register_blueprint=True):
+def create_app(config, **kwargs):
app = create_base_app(config)
- app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root@localhost/flask_security_test'
+ #app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root@localhost/flask_security_test'
+ app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://'
db = SQLAlchemy(app)
@@ -50,8 +51,7 @@ def create_app(config, register_blueprint=True):
db.create_all()
populate_data(app.config.get('USER_COUNT', None))
- app.security = Security(app, SQLAlchemyUserDatastore(db, User, Role),
- register_blueprint=register_blueprint)
+ app.security = Security(app, datastore=SQLAlchemyUserDatastore(db, User, Role), **kwargs)
add_context_processors(app.security)