@@ -196,7 +196,7 @@ class DBConverter(object):
cur.execute("SELECT DBVERSION FROM DBVERSION")
row = cur.fetchone()
if not row:
- return "0.3" # pragma: no cover
+ return "0.3"
else:
return row[0]
@@ -32,7 +32,8 @@ class CryptoTest(unittest.TestCase):
self.assertTrue(True)
def test_get(self):
- old_engine = CryptoEngine.get()
+ CryptoEngine._instance_new = None
+ old_engine = CryptoEngine.get(0.4)
self.assertIsInstance(old_engine, CryptoEngineOld)
CryptoEngine._instance = None
new_engine = CryptoEngine.get(dbver=0.5)
@@ -66,9 +66,6 @@ def node_factory(username, password, url, notes, tags=None):
return node
-# TODO: fix hard coded db versions! 0.4 should be replaced with
-# from pwman.data.database import __DB_FORMAT__
-
_saveconfig = False
PwmanCliNew, OSX = get_ui_platform(sys.platform)
@@ -378,6 +378,8 @@ class CreateTestDataBases(object):
enc1.set_cryptedkey(key)
self.add_nodes_to_db1()
+ CryptoEngine._instance = None
+
self.db2._open()
enc2 = CryptoEngine.get(dbver=0.5)
enc2.set_callback(DummyCallback4())
@@ -406,10 +408,8 @@ if __name__ == '__main__':
tester.run()
# afther the test databases are created, invoking
# pwman3 -d konverter-v0.5.db
- # initiates an OldCrypto instance, which can not
- # decrypt the database, which is expected!
- # However, this database has the false database version
- # select DBVERSION from DBVERSION
- # returns -> 0.4, which is wrong. This should be 0.5
assert "0.4" == DBConverter.detect_db_version('konverter-v0.4.db')
assert "0.5" == DBConverter.detect_db_version('konverter-v0.5.db')
+ # python scripts/pwman3 -d konverter-v0.5.db -e AES,
+ # works !