def __init__(self): config.set_defaults(default_config) enc = CryptoEngine.get(dbver=0.4) enc.callback = DummyCallback4() self.enc1 = copy.copy(enc) enc = CryptoEngine.get(dbver=0.5) enc.callback = DummyCallback4() self.enc2 = copy.copy(enc) self.db1 = SQLiteDatabaseNewForm('konverter-v0.4.db', dbformat=0.4) self.db2 = SQLiteDatabaseNewForm('konverter-v0.5.db', dbformat=0.5) assert self.enc1 is not self.enc2
class CreateTestDataBases(object): def __init__(self): config.set_defaults(default_config) enc = CryptoEngine.get() enc.set_callback(CLICallback()) self.db1 = SQLiteDatabaseNewForm('konverter-v0.4.db', dbformat=0.4) self.db2 = SQLiteDatabaseNewForm('konverter-v0.5.db', dbformat=0.5) def open_dbs(self): self.db1._open() self.db2._open() self.db1.close() self.db2.close() def add_nodes_to_db1(self): username = '******' password = '******' url = 'example.org' notes = 'some notes' node = node_factory(username, password, url, notes, ['testing1', 'testing2']) self.db.open() self.db.addnodes([node]) idx_created = node._id new_node = self.db.getnodes([idx_created])[0] for key, attr in {'password': password, 'username': username, 'url': url, 'notes': notes}.iteritems(): self.assertEquals(attr, getattr(new_node, key)) self.db.close() def run(self): self.open_dbs() # before add nodes to db1 we have to create an encryption key! #enc = CryptoEngine.get(dbver=dbver) #key = db.loadkey() #if key is not None: #enc.set_cryptedkey(key) #else: # self.get_user_password() self.add_nodes_to_db1()
class CreateTestDataBases(object): def __init__(self): config.set_defaults(default_config) enc = CryptoEngine.get(dbver=0.4) enc.callback = DummyCallback4() self.enc1 = copy.copy(enc) enc = CryptoEngine.get(dbver=0.5) enc.callback = DummyCallback4() self.enc2 = copy.copy(enc) self.db1 = SQLiteDatabaseNewForm('konverter-v0.4.db', dbformat=0.4) self.db2 = SQLiteDatabaseNewForm('konverter-v0.5.db', dbformat=0.5) assert self.enc1 is not self.enc2 def open_dbs(self): self.db1._open() self.db2._open() self.db1.close() self.db2.close() def add_nodes_to_db1(self): username = '******' password = '******' url = 'example.org' notes = 'some notes' node = node_factory(username, password, url, notes, ['testing1', 'testing2']) self.db1.addnodes([node]) idx_created = node._id new_node = self.db1.getnodes([idx_created])[0] for key, attr in {'password': password, 'username': username, 'url': url, 'notes': notes}.iteritems(): assert attr == getattr(new_node, key) self.db1.close() def add_nodes_to_db2(self): username = '******' password = '******' url = 'example.org' notes = 'some notes' node = node_factory(username, password, url, notes, ['testing1', 'testing2']) self.db2.addnodes([node]) idx_created = node._id new_node = self.db2.getnodes([idx_created])[0] for key, attr in {'password': password, 'username': username, 'url': url, 'notes': notes}.iteritems(): assert attr == getattr(new_node, key) self.db2.close() def run(self): # before add nodes to db1 we have to create an encryption key! # this is handeld by the open method self.db1._open() enc1 = CryptoEngine.get(dbver=0.4) enc1.callback = DummyCallback4() key = self.db1.loadkey() if key is not None: enc1.set_cryptedkey(key) else: newkey = enc1.changepassword() self.db1.savekey(newkey) enc1c = copy.copy(enc1) if key is not None: enc1.set_cryptedkey(key) self.add_nodes_to_db1() CryptoEngine._instance = None self.db2._open() enc2 = CryptoEngine.get(dbver=0.5) enc2.callback = DummyCallback4() key = self.db2.loadkey() if key is not None: enc2.set_cryptedkey(key) else: newkey = enc2.changepassword() self.db2.savekey(newkey) enc2c = copy.copy(enc2) if key is not None: enc2.set_cryptedkey(key) self.add_nodes_to_db2() assert enc1 is not enc2 assert enc1c is not enc2c
def __init__(self): config.set_defaults(default_config) enc = CryptoEngine.get() enc.set_callback(CLICallback()) self.db1 = SQLiteDatabaseNewForm('konverter-v0.4.db', dbformat=0.4) self.db2 = SQLiteDatabaseNewForm('konverter-v0.5.db', dbformat=0.5)