def setUp(self):
        middleware = []
        self.logger = logging.getLogger('restapi')
        urls = karesansui.urls.urls
        app = web.application(urls, globals(), autoreload=False)

        from karesansui.app import load_sqlalchemy_karesansui,load_sqlalchemy_pysilhouette
        app.add_processor(load_sqlalchemy_karesansui)
        app.add_processor(load_sqlalchemy_pysilhouette)

        self.prefix = ""
        if karesansui.config['application.url.prefix']:
            mapping = (karesansui.config['application.url.prefix'],  app)
            app = web.subdir_application(mapping)
            self.prefix = karesansui.config['application.url.prefix']

        self.app = TestApp(app.wsgifunc(*middleware))

        self.headers = {}
        if username != None and password != None:
            from base64 import b64encode
            base64string =b64encode("%s:%s" % (username, password))
            self.headers = {"Authorization": "Basic %s" % base64string}

        return True
dataset/ETHPy150Open karesansui/karesansui/karesansui/tests/restapi/__init__.py/TestRestAPI.setUp/original