Пример #1
0
 def setup(self):
     self.db.reset()
     self.cur = self.dbh.cursor(self.db)
     self.sconfig = SConfig(self.cur)
Пример #2
0
class TransactionalTest:

    db = None
    cur = None
    dbh = None

    def __init__(self):
        self.dbh = DbHelper()
        self.db = self.dbh.conn()

    def setup(self):
        self.db.reset()
        self.cur = self.dbh.cursor(self.db)
        self.sconfig = SConfig(self.cur)

    def teardown(self):
        self.db.rollback()

    def cr_app(self, name, inherits_from=None):
        self.sconfig.create_app(name, inherits_from)

    def cr_apps(self, *names):
        for name in names:
            self.sconfig.create_app(name)

    def del_app(self, name):
        self.sconfig.delete_app(name)

    def apps(self):
        return self.sconfig.get_apps()

    def del_all(self):
        self.sconfig.delete_all()

    def rename_app(self, old_name, new_name):
        self.sconfig.rename_app(old_name, new_name)

    def val(self, appname, setting_name):
        return self.sconfig.get_value(appname, setting_name)

    def val_set(self, appname, setting_name, value):
        self.sconfig.set_value(appname, setting_name, value)

    def app_exists(self, appname):
        return self.sconfig.app_exists(appname)

    def delete_settings(self, appname):
        return self.sconfig.delete_settings(appname)

    def get_settings_names(self, appname):
        return self.sconfig.get_settings_names(appname)

    def inherits_from(self, appname1, appname2):
        return self.sconfig.inherits_from(appname1, appname2)