Example #1
0
    def test_reconfiguration(self):
        ConnectionManager.configure()

        self.assertEqual(UserDocument.db.name, 'test')

        ConnectionManager.configure({'userdocument': {'db': 'test2'}})
        self.assertEqual(UserDocument.db.name, 'test2')
Example #2
0
    def test_reconfiguration(self):
        ConnectionManager.configure()

        self.assertEqual(UserDocument.db.name, 'test')

        ConnectionManager.configure({'userdocument': {'db': 'test2'}})
        self.assertEqual(UserDocument.db.name, 'test2')
Example #3
0
    def test_configuration_use_col_from_config(self):
        config_name = 'my_custom_config_name'
        UserDocument.config_name = config_name

        col_name = 'my_custom_col'
        ConnectionManager.configure({config_name: {'col': col_name}})

        self.assertEqual(UserDocument.col.name, col_name)
Example #4
0
    def test_configuration_use_col_from_config(self):
        config_name = 'my_custom_config_name'
        UserDocument.config_name = config_name

        col_name = 'my_custom_col'
        ConnectionManager.configure({config_name: {'col': col_name}})

        self.assertEqual(UserDocument.col.name, col_name)
Example #5
0
    def test_configuration_use_config_name(self):
        config_name = 'my_custom_config_name'
        UserDocument.config_name = config_name

        db_name = 'my_custom_db'

        ConnectionManager.configure({config_name: {'db': db_name}})

        self.assertEqual(UserDocument.db.name, db_name)
        self.assertEqual(UserDocument.col.database.name, db_name)
Example #6
0
    def test_configuration_use_config_name(self):
        config_name = 'my_custom_config_name'
        UserDocument.config_name = config_name

        db_name = 'my_custom_db'

        ConnectionManager.configure({config_name: {'db': db_name}})

        self.assertEqual(UserDocument.db.name, db_name)
        self.assertEqual(UserDocument.col.database.name, db_name)
Example #7
0
from picomongo import ConnectionManager

PICOMONGO_CONFIG = {'_default_': {'db': 'FeedLight'}}

TWITTER_APP_TOKEN = "YOUR_TWITTER_APP_TOKEN"
TWITTER_APP_SECRET = "YOUR_TWITTER_APP_SECRET"

FACEBOOK_APP_TOKEN = "YOUR_FACEBOOK_APP_TOKEN"
FACEBOOK_APP_SECRET = "YOUR_FACEBOOK_APP_SECRET"

POCKET_APP_TOKEN = "YOUR_POCKET_APP_TOKEN"

DIFFBOT_APP_TOKEN = "YOUR_DIFFBOT_APP_TOKEN"

INTERCOM_APP_TOKEN = "YOUR_INTERCOM_APP_TOKEN"

FLASK_CONFIG = {
    'SERVER_NAME': 'feedlight.dev:5000',
    'audience': 'http://feedlight.dev:5000'
}

ConnectionManager.configure(PICOMONGO_CONFIG)
Example #8
0
 def setUp(self):
     ConnectionManager.configure()
Example #9
0
    def test_access_config(self):
        ConnectionManager.configure()

        self.assertTrue(isinstance(UserDocument.col, Collection))
        self.assertTrue(isinstance(UserDocument.db, Database))
        self.assertTrue(isinstance(UserDocument.con, Connection))
Example #10
0
                _hidden = 2,
        )

    def test_filter(self):
        self.assertEqual(
                _filter_dict(self.a_dict),
                dict(a_key = 1)
        )

try:
    ConnectionManager.configure(
        {
            '_default_' : {
                'uri' : 'mongodb://localhost/',
                'db' : 'state',
            },
            'state': {
### http://docs.mongodb.org/manual/reference/connection-string/
                'col' : 'state',
            }
        }
    )

except Exception as e:
    import sys
    sys.stderr.write("*" * 70 +
            "\nTestState DISABLED no local instance available\n" +
            "*" * 70 + "\n" * 2)
    del( TestState )

if __name__ == '__main__':
Example #11
0
 def setUp(self):
     ConnectionManager.configure()
Example #12
0
    def test_access_config(self):
        ConnectionManager.configure()

        self.assertTrue(isinstance(UserDocument.col, Collection))
        self.assertTrue(isinstance(UserDocument.db, Database))
        self.assertTrue(isinstance(UserDocument.con, Connection))