|
@@ -0,0 +1,55 @@
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+import os
|
|
|
+import unittest
|
|
|
+from pwman.util.crypto_engine import CryptoEngine
|
|
|
+from collections import namedtuple
|
|
|
+from .test_crypto_engine import give_key, DummyCallback
|
|
|
+from pwman.exchange.importer import CSVImporter
|
|
|
+
|
|
|
+import_example = """
|
|
|
+Username;URL;Password;Notes;Tags
|
|
|
+alice;wonderland.com;secert;scratch;foo,bar
|
|
|
+hatman;behindthemirror.com;pa33w0rd;scratch;foo,bar
|
|
|
+"""
|
|
|
+
|
|
|
+with open('import_file.csv', 'w') as f:
|
|
|
+ f.write(import_example)
|
|
|
+
|
|
|
+
|
|
|
+class TestImporter(unittest.TestCase):
|
|
|
+
|
|
|
+ def setUp(self):
|
|
|
+ config = {}
|
|
|
+ Args = namedtuple('args', 'import_file')
|
|
|
+ self.importer = CSVImporter(Args(import_file='foo'), config)
|
|
|
+
|
|
|
+ def test_fail(self):
|
|
|
+ self.assertTrue(True)
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+
|
|
|
+ ce = CryptoEngine.get()
|
|
|
+ ce.callback = DummyCallback()
|
|
|
+ ce.changepassword(reader=give_key)
|
|
|
+
|
|
|
+ try:
|
|
|
+ unittest.main(verbosity=2, failfast=True)
|
|
|
+ except SystemExit:
|
|
|
+ os.remove('import_file.csv')
|