Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(9)  |  Derive(0)  |  Import(0)
Initializes the Flask app for use with Simon.

This method will automatically be called if the app is passed
into ``__init__()``.

:param app: the Flask application.
:type app: :class:`flask.Flask`
:param prefix: (optional) the prefix of the config settings
:type prefix: str
:param alias: (optional) the alias to use for the database(more...)

src/f/l/Flask-Simon-0.3.0/tests/test_simon.py   Flask-Simon(Download)
        simon = Simon()
        with mock.patch('simon.connection.connect') as connect:
            simon.init_app(self.app)
 
            connect.assert_called_with('localhost:27017', name='test',
                                       alias=None, username=None,
                                       password=None, replica_set=None)
 
            simon.init_app(self.app, prefix='SIMON', alias='simon')
        simon = Simon()
        with self.assertRaises(InvalidURI):
            simon.init_app(self.app)
 
    def test_init_app_multiple_connections(self):
        simon = Simon()
        with mock.patch('simon.connection.connect') as connect:
            simon.init_app(self.app, prefix='MONGO')
 
            connect.assert_called_with(url1, name='simon', alias=None,
                                       username='simonu', password='simonp',
                                       replica_set=None)
 
            simon.init_app(self.app, prefix='SIMON')