|
@@ -17,10 +17,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
-from pwman.data.nodes import NewNode
|
|
|
-
|
|
|
from pwman.data import factory
|
|
|
-from pwman.data.drivers.sqlite import DatabaseException, SQLiteDatabaseNewForm
|
|
|
+
|
|
|
from pwman.util.config import get_pass_conf
|
|
|
from pwman.util.generator import leetlist
|
|
|
from pwman.util.crypto_engine import CryptoEngine
|
|
@@ -239,39 +237,39 @@ class CLITests(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
|
|
- def test_add_new_entry(self):
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- node = NewNode()
|
|
|
- node.username = b'alice'
|
|
|
- node.password = b'dough!'
|
|
|
- node.url = b'example.com'
|
|
|
- node.notes = b'somenotes'
|
|
|
- node.tags = b'lorem ipsum'
|
|
|
-
|
|
|
- tags = self.tester.cli.get_tags(reader=lambda: u'looking glass')
|
|
|
- node.tags = tags
|
|
|
- self.tester.cli._db.addnodes([node])
|
|
|
- self.tester.cli._db._cur.execute(
|
|
|
- "SELECT ID FROM NODES ORDER BY ID ASC", [])
|
|
|
- rows = self.tester.cli._db._cur.fetchall()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- self.assertEqual(len(rows), 2)
|
|
|
+
|
|
|
|
|
|
- node = NewNode()
|
|
|
- node.username = b'alice'
|
|
|
- node.password = b'dough!'
|
|
|
- node.url = b'example.com'
|
|
|
- node.notes = b'somenotes'
|
|
|
- node.tags = b'lorem ipsum'
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- tags = self.tester.cli.get_tags(reader=lambda: u'looking glass')
|
|
|
- node.tags = tags
|
|
|
- self.tester.cli._db.addnodes([node])
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
def test_get_ids(self):
|
|
|
|
|
@@ -356,14 +354,14 @@ class FactoryTest(unittest.TestCase):
|
|
|
self.assertEqual(factory.check_db_version('SQLite', 'baz.db'), 0.3)
|
|
|
os.unlink('baz.db')
|
|
|
|
|
|
- def test_factory_create(self):
|
|
|
- db = factory.create('SQLite', filename='foo.db')
|
|
|
- db._open()
|
|
|
- self.assertTrue(os.path.exists('foo.db'))
|
|
|
- db.close()
|
|
|
- os.unlink('foo.db')
|
|
|
- self.assertIsInstance(db, SQLiteDatabaseNewForm)
|
|
|
- self.assertRaises(DatabaseException, factory.create, 'UNKNOWN')
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|