Example #1
0
    def setUp(self):
        self.maxDiff = None
        
        self.boxclient = AdsabsBaseTestCase.initMongo()
        self.boxclient['admin'].authenticate('foo','bar')
        self.boxclient.drop_database('test')
        self.boxclient['test'].add_user('test','test')

        config.TESTING = True
        config.MONGOALCHEMY_SERVER = 'localhost'
        config.MONGOALCHEMY_PORT = self.box.port
        config.MONGOALCHEMY_DATABASE = 'test'
        config.MONGOALCHEMY_USER = '******'
        config.MONGOALCHEMY_PASSWORD = '******'
        config.LOGGING_LOG_LEVEL = 'WARN'
        # adsgut mongo connection stuff
        config.MONGODB_SETTINGS= {
            'PORT': self.box.port,
            'HOST': 'mongodb://*****:*****@localhost/test', 
            'DB': 'test'
        }
        config.CSRF_ENABLED = False
        config.DEBUG = False
        config.PRINT_DEBUG_TEMPLATE = False
        config.REDIS_ENABLE = False
        config.SECRET_KEY = 'abcd1234'
        
        self.app = create_app(config)
        self.client = self.app.test_client()
        self.insert_user = user_creator
Example #2
0
    def setUp(self):
        self.box = mongobox.MongoBox(scripting=True, auth=True)
        self.box.start()
        self.boxclient = self.box.client()
        self.boxclient["admin"].add_user("foo", "bar")
        self.boxclient["admin"].authenticate("foo", "bar")
        self.boxclient["test"].add_user("test", "test")

        @atexit.register
        def cleanupMongo():
            try:
                self.box.stop()
            except:
                pass

        config.TESTING = True
        config.MONGOALCHEMY_SERVER = "localhost"
        config.MONGOALCHEMY_PORT = self.box.port
        config.MONGOALCHEMY_DATABASE = "test"
        config.MONGOALCHEMY_USER = "******"
        config.MONGOALCHEMY_PASSWORD = "******"
        config.LOGGING_LOG_LEVEL = "WARN"
        config.CSRF_ENABLED = False
        config.DEBUG = False
        config.PRINT_DEBUG_TEMPLATE = False
        config.REDIS_ENABLE = False
        config.SECRET_KEY = "abcd1234"

        try:
            self.app = create_app(config)
            self.client = self.app.test_client()
            self.insert_user = user_creator
        except:
            # otherwise exceptions in create_app could leave a ton of mongobox procs layting around
            self.box.stop()
            raise
 def setUp(self):
     config.TESTING = True
     app = create_app(config)
     self.app = app.test_client()
Example #4
0
from adsabs.app import create_app

if __name__ == '__main__':
    app = create_app()
    app.run()