forked from orbit-oss/flask
Add Config.from_mapping
This commit is contained in:
parent
02f0c755a3
commit
aa40b1731e
3 changed files with 51 additions and 0 deletions
|
|
@ -47,6 +47,34 @@ class ConfigTestCase(FlaskTestCase):
|
|||
app.config.from_json(os.path.join(current_dir, 'static', 'config.json'))
|
||||
self.common_object_test(app)
|
||||
|
||||
def test_config_from_mapping(self):
|
||||
app = flask.Flask(__name__)
|
||||
app.config.from_mapping({
|
||||
'SECRET_KEY': 'devkey',
|
||||
'TEST_KEY': 'foo'
|
||||
})
|
||||
self.common_object_test(app)
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
app.config.from_mapping([
|
||||
('SECRET_KEY', 'devkey'),
|
||||
('TEST_KEY', 'foo')
|
||||
])
|
||||
self.common_object_test(app)
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
app.config.from_mapping(
|
||||
SECRET_KEY='devkey',
|
||||
TEST_KEY='foo'
|
||||
)
|
||||
self.common_object_test(app)
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
with self.assert_raises(TypeError):
|
||||
app.config.from_mapping(
|
||||
{}, {}
|
||||
)
|
||||
|
||||
def test_config_from_class(self):
|
||||
class Base(object):
|
||||
TEST_KEY = 'foo'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue