当前位置: 首页>>代码示例>>Python>>正文


Python GLSettings.make_db_uri方法代码示例

本文整理汇总了Python中globaleaks.settings.GLSettings.make_db_uri方法的典型用法代码示例。如果您正苦于以下问题:Python GLSettings.make_db_uri方法的具体用法?Python GLSettings.make_db_uri怎么用?Python GLSettings.make_db_uri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在globaleaks.settings.GLSettings的用法示例。


在下文中一共展示了GLSettings.make_db_uri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from globaleaks.settings import GLSettings [as 别名]
# 或者: from globaleaks.settings.GLSettings import make_db_uri [as 别名]
    def setUp(self):
        helpers.init_glsettings_for_unit_tests()

        GLSettings.db_path = os.path.join(GLSettings.ramdisk_path, 'db_test')
        os.mkdir(GLSettings.db_path)
        db_name = 'glbackend-%d.db' % DATABASE_VERSION
        db_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'db', 'populated', db_name)
        shutil.copyfile(db_path, os.path.join(GLSettings.db_path, db_name))

        self.db_file = os.path.join(GLSettings.db_path, db_name)
        GLSettings.db_uri = GLSettings.make_db_uri(self.db_file)

        # place a dummy version in the current db
        store = Store(create_database(GLSettings.db_uri))
        prv = config.PrivateFactory(store)
        self.dummy_ver = '2.XX.XX'
        prv.set_val('version', self.dummy_ver)
        self.assertEqual(prv.get_val('version'), self.dummy_ver)
        store.commit()
        store.close()

        # backup various mocks that we will use
        self._bck_f = config.is_cfg_valid
        GLConfig['private']['xx_smtp_password'] = GLConfig['private'].pop('smtp_password')
        self.dp = u'yes_you_really_should_change_me'
开发者ID:Taipo,项目名称:GlobaLeaks,代码行数:27,代码来源:test_migration.py

示例2: _test

# 需要导入模块: from globaleaks.settings import GLSettings [as 别名]
# 或者: from globaleaks.settings.GLSettings import make_db_uri [as 别名]
    def _test(self, path, f):
        helpers.init_glsettings_for_unit_tests()
        GLSettings.db_path = os.path.join(GLSettings.ramdisk_path, 'db_test')
        final_db_file = os.path.abspath(os.path.join(GLSettings.db_path, 'glbackend-%d.db' % DATABASE_VERSION))
        GLSettings.db_uri = GLSettings.make_db_uri(final_db_file)

        os.mkdir(GLSettings.db_path)
        dbpath = os.path.join(path, f)
        dbfile = os.path.join(GLSettings.db_path, f)
        shutil.copyfile(dbpath, dbfile)
        ret = perform_system_update()
        shutil.rmtree(GLSettings.db_path)
        self.assertNotEqual(ret, -1)
开发者ID:Taipo,项目名称:GlobaLeaks,代码行数:15,代码来源:test_migration.py

示例3: _initStartDB

# 需要导入模块: from globaleaks.settings import GLSettings [as 别名]
# 或者: from globaleaks.settings.GLSettings import make_db_uri [as 别名]
    def _initStartDB(self, target_ver):
        helpers.init_glsettings_for_unit_tests()

        GLSettings.db_path = os.path.join(GLSettings.ramdisk_path, 'db_test')
        os.mkdir(GLSettings.db_path)
        db_name = 'glbackend-%d.db' % target_ver
        db_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'db', 'populated', db_name)
        shutil.copyfile(db_path, os.path.join(GLSettings.db_path, db_name))

        self.db_file = os.path.join(GLSettings.db_path, db_name)
        GLSettings.db_uri = GLSettings.make_db_uri(self.db_file)

        self.store = Store(create_database(GLSettings.db_uri))
开发者ID:Taipo,项目名称:GlobaLeaks,代码行数:15,代码来源:test_migration.py


注:本文中的globaleaks.settings.GLSettings.make_db_uri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。