Browse Source

Added tests for old imports

pull/325/head
Armin Ronacher 13 years ago
parent
commit
f80bfcaa28
  1. 33
      flask/testsuite/ext.py
  2. 0
      flask/testsuite/test_apps/flaskext/__init__.py
  3. 1
      flask/testsuite/test_apps/flaskext/oldext_package/__init__.py
  4. 2
      flask/testsuite/test_apps/flaskext/oldext_package/submodule.py
  5. 1
      flask/testsuite/test_apps/flaskext/oldext_simple.py

33
flask/testsuite/ext.py

@ -31,29 +31,52 @@ class ExtImportHookTestCase(FlaskTestCase):
import_hooks += 1
self.assert_equal(import_hooks, 1)
def test_flaskext_simple_import_normal(self):
def test_flaskext_new_simple_import_normal(self):
from flask.ext.newext_simple import ext_id
self.assert_equal(ext_id, 'newext_simple')
def test_flaskext_simple_import_module(self):
def test_flaskext_new_simple_import_module(self):
from flask.ext import newext_simple
self.assert_equal(newext_simple.ext_id, 'newext_simple')
self.assert_equal(newext_simple.__name__, 'flask_newext_simple')
def test_flaskext_package_import_normal(self):
def test_flaskext_new_package_import_normal(self):
from flask.ext.newext_package import ext_id
self.assert_equal(ext_id, 'newext_package')
def test_flaskext_package_import_module(self):
def test_flaskext_new_package_import_module(self):
from flask.ext import newext_package
self.assert_equal(newext_package.ext_id, 'newext_package')
self.assert_equal(newext_package.__name__, 'flask_newext_package')
def test_flaskext_package_import_submodule(self):
def test_flaskext_new_package_import_submodule(self):
from flask.ext.newext_package import submodule
self.assert_equal(submodule.__name__, 'flask_newext_package.submodule')
self.assert_equal(submodule.test_function(), 42)
def test_flaskext_old_simple_import_normal(self):
from flask.ext.oldext_simple import ext_id
self.assert_equal(ext_id, 'oldext_simple')
def test_flaskext_old_simple_import_module(self):
from flask.ext import oldext_simple
self.assert_equal(oldext_simple.ext_id, 'oldext_simple')
self.assert_equal(oldext_simple.__name__, 'flaskext.oldext_simple')
def test_flaskext_old_package_import_normal(self):
from flask.ext.oldext_package import ext_id
self.assert_equal(ext_id, 'oldext_package')
def test_flaskext_old_package_import_module(self):
from flask.ext import oldext_package
self.assert_equal(oldext_package.ext_id, 'oldext_package')
self.assert_equal(oldext_package.__name__, 'flaskext.oldext_package')
def test_flaskext_old_package_import_submodule(self):
from flask.ext.oldext_package import submodule
self.assert_equal(submodule.__name__, 'flaskext.oldext_package.submodule')
self.assert_equal(submodule.test_function(), 42)
def suite():
suite = unittest.TestSuite()

0
flask/testsuite/test_apps/flaskext/__init__.py

1
flask/testsuite/test_apps/flaskext/oldext_package/__init__.py

@ -0,0 +1 @@
ext_id = 'oldext_package'

2
flask/testsuite/test_apps/flaskext/oldext_package/submodule.py

@ -0,0 +1,2 @@
def test_function():
return 42

1
flask/testsuite/test_apps/flaskext/oldext_simple.py

@ -0,0 +1 @@
ext_id = 'oldext_simple'
Loading…
Cancel
Save