소스 검색

Fix broken build...

oz123 10 년 전
부모
커밋
3a81343c9f
2개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      pwman/tests/test_base_ui.py
  2. 5 2
      pwman/ui/baseui.py

+ 1 - 1
pwman/tests/test_base_ui.py

@@ -55,7 +55,7 @@ class TestBaseUI(unittest.TestCase):
     def test_1_do_new(self):
         sys.stdin = StringIO(("alice\nsecret\nexample.com\nsome notes"
                               "\nfoo bar baz"))
-        _node = self.tester.cli.do_new('')
+        _node = self.tester.cli._do_new('')
 
         sys.stdin = sys.__stdin__
         self.assertListEqual(['foo', 'bar', 'baz'], [t.decode() for t

+ 5 - 2
pwman/ui/baseui.py

@@ -224,7 +224,7 @@ class BaseCommands(HelpUI):
             p = sys.stdin.readline().rstrip()
         return p
 
-    def do_new(self, args):
+    def _do_new(self, args):
         node = {}
         node['username'] = self._get_input("Username: ")
         node['password'] = self._get_secret()
@@ -233,8 +233,11 @@ class BaseCommands(HelpUI):
         node['tags'] = self._get_tags()
         node = Node(clear_text=True, **node)
         self._db.add_node(node)
+        return node
+
+    def do_new(self, args):  # pragma: no cover
         # The cmd module stops if and of do_* return something
         # else than None ...
         # This is bad for testing, so everything that is do_*
         # should call _do_* method which is testable
-        # return node
+        self._do_new(args)