Browse Source

Fix broken tests

oz123 10 năm trước cách đây
mục cha
commit
0e9ebe315a
3 tập tin đã thay đổi với 7 bổ sung7 xóa
  1. 1 1
      pwman/tests/test_base_ui.py
  2. 2 2
      pwman/tests/test_importer.py
  3. 4 4
      pwman/ui/baseui.py

+ 1 - 1
pwman/tests/test_base_ui.py

@@ -64,7 +64,7 @@ class TestBaseUI(unittest.TestCase):
         _node = self.tester.cli._do_new('')
 
         sys.stdin = sys.__stdin__
-        self.assertListEqual(['foo', 'bar', 'baz'], [t.decode() for t
+        self.assertListEqual(['foo', 'bar', 'baz'], [t for t
                                                      in _node.tags])
         nodeid = self.tester.cli._db.listnodes()
         self.assertListEqual([1], nodeid)

+ 2 - 2
pwman/tests/test_importer.py

@@ -45,7 +45,7 @@ class TestImporter(unittest.TestCase):
 
     def test_read_file(self):
         lines = self.importer._read_file()
-        self.assertNotIn(["Username", "URL", "Password", "Notes"," Tags"],
+        self.assertNotIn(["Username", "URL", "Password", "Notes", " Tags"],
                          lines)
 
     def test_create_node(self):
@@ -54,7 +54,7 @@ class TestImporter(unittest.TestCase):
         node = self.importer._create_node(n)
         ce = CryptoEngine.get()
         self.assertEqual(ce.decrypt(node._username).decode(), u'alice')
-        self.assertEqual(['foo', 'bar'], [t.decode() for t in node.tags])
+        self.assertEqual(['foo', 'bar'], [t for t in node.tags])
 
     def test_insert_node(self):
         n = "alice;wonderland.com;secert;scratch;foo,bar".split(";")

+ 4 - 4
pwman/ui/baseui.py

@@ -311,7 +311,7 @@ class BaseCommands(HelpUIMixin, AliasesMixin):
                                                 node[4],
                                                 node[5:])
                 tags = n.tags
-                tags = ','.join(t.strip().decode() for t in tags)
+                tags = ','.join(t.strip() for t in tags)
                 r = list([n.username, n.url, n.password, n.notes])
                 writer.writerow(r + [tags])
 
@@ -372,9 +372,9 @@ class BaseCommands(HelpUIMixin, AliasesMixin):
                           ur=20, tg=tag_pad - 32))
 
     def _print_node_line(self, node, rows, cols):
-        tagstring = ','.join([t.decode() for t in node.tags])
-        fmt = self._format_line(cols - 32, node._id, node.username.decode(),
-                                node.url.decode(),
+        tagstring = ','.join([t for t in node.tags])
+        fmt = self._format_line(cols - 32, node._id, node.username,
+                                node.url,
                                 tagstring)
         formatted_entry = tools.typeset(fmt, Fore.YELLOW, False)
         print(formatted_entry)