Browse Source

break things while migrating to new text ui class

oz123 10 years ago
parent
commit
94f63b1965
3 changed files with 26 additions and 6 deletions
  1. 1 1
      pwman/tests/test_base_ui.py
  2. 23 3
      pwman/ui/baseui.py
  3. 2 2
      pwman/ui/cli.py

+ 1 - 1
pwman/tests/test_base_ui.py

@@ -25,7 +25,7 @@ from .test_crypto_engine import give_key, DummyCallback
 from pwman.ui.baseui import BaseCommands
 
 
-class TestSQLite(unittest.TestCase):
+class TestBaseUI(unittest.TestCase):
 
     pass
 

+ 23 - 3
pwman/ui/baseui.py

@@ -1,4 +1,4 @@
-# ============================================================================
+# ===========================================================================
 # This file is part of Pwman3.
 #
 # Pwman3 is free software; you can redistribute it and/or modify
@@ -59,9 +59,9 @@ class BaseCommands(HelpUI):
         password"""
         pass
 
-    def do_cls(self, args):
+    def do_cls(self, args):  # pragma: no cover
         """clear the screen"""
-        pass
+        os.system("clear")
 
     def do_edit(self, args):
         """edit a node"""
@@ -77,5 +77,25 @@ class BaseCommands(HelpUI):
 
     def do_tags(self, args):
         """print all existing tags """
+        pass
 
+    def do_listn(self, args):
+        """list all existing nodes in database"""
+        self.do_cls('')
+        self.do_filter(args)
+        nodeids = self._db.listnodes()
+        nodes = self._db.getnodes(nodeids)
+        _nodes_inst = []
+        # user, pass, url, notes
+        for node in nodes:
+            _nodes_inst.append(Node.from_encrypted_entries(
+                node[1],
+                'xxxxx',
+                node[2],
+                'yyyyy',
+                []))
+        for node in _nodes_inst:
+            print(node)
 
+    def do_filter(args):
+        pass

+ 2 - 2
pwman/ui/cli.py

@@ -27,8 +27,8 @@ import pwman
 from pwman.util.crypto_engine import CryptoEngine
 import sys
 import cmd
-from pwman.ui.base import Aliases, BaseCommands
-
+from pwman.ui.base import Aliases  # BaseCommands
+from pwman.ui.baseui import BaseCommands
 try:
     import readline
     _readline_available = True