예제 #1
0
파일: tests.py 프로젝트: jab/radarpost
    def setUp(self):
        # XXX load it!
        self.config = {'web.apps': ['radarpost.web.api'], 
                       'web.debug': True,
                       'web.static_files_url': '/static',
                       'beaker.session.type': 'memory', 
                       'couchdb.users_database': self.TEST_USERS_DB,
                       'couchdb.address': 'http://localhost:5984',
                       'couchdb.prefix': 'radar/'
                       }

        self.url_gen = URLGenerator(build_routes(self.config), {})

        # set-up users database
        couchdb = get_couchdb_server(self.config)
        dbname = self.config['couchdb.users_database']
        if dbname in couchdb: 
            del couchdb[dbname]
        self._users_db = couchdb.create(dbname)
        
        # create an admin
        admin = User(username=self.TEST_ADMIN_USER,
                     password=self.TEST_ADMIN_PASSWORD)
        admin.roles = [ROLE_ADMIN]
        admin.store(self._users_db)
예제 #2
0
파일: app.py 프로젝트: jab/radarpost
def make_app(config, ContextType=RequestContext):
    """
    builds a full application stack.  These can be composed
    and configured elsewhere / differently as needed.
    """
    app = Application(config, ContextType=ContextType)
    app = RoutesMiddleware(wsgi_app=app, mapper=build_routes(config),
                           use_method_override=False, singleton=False)

    beaker_options = config_section('beaker.session.',
                                    config, reprefix='session.')
    if len(beaker_options) > 0:
        app = SessionMiddleware(app, beaker_options)
    return app
예제 #3
0
파일: tests.py 프로젝트: ltucker/radarpost
    def setUp(self):
        self.config = load_test_config()
        self.url_gen = URLGenerator(build_routes(self.config), {})

        # set-up users database
        couchdb = get_couchdb_server(self.config)
        dbname = self.config['couchdb.users_database']
        if dbname in couchdb: 
            del couchdb[dbname]
        self._users_db = couchdb.create(dbname)
        
        # create an admin
        admin = User(username=self.config['test.admin_user'],
                     password=self.config['test.admin_password'])
        admin.roles = [ROLE_ADMIN]
        admin.store(self._users_db)