Browse Source

Merge branch 'master' of https://github.com/pwman3/pwman3

oz123 11 years ago
parent
commit
a780c0a418
6 changed files with 35 additions and 18 deletions
  1. 4 0
      .gitignore
  2. 12 0
      pwman/tests/__init__.py
  3. 0 3
      pwman/tests/db_tests.py
  4. 12 5
      pwman/tests/test_pwman.py
  5. 2 2
      pwman/ui/cli.py
  6. 5 8
      setup.py

+ 4 - 0
.gitignore

@@ -1,3 +1,7 @@
 *.pyc
 build/*
 dist/*
+*.swp
+*.egg
+*.db
+env/*

+ 12 - 0
pwman/tests/__init__.py

@@ -0,0 +1,12 @@
+import test_pwman
+
+def suite():
+    import unittest
+    #import doctest
+    suite = unittest.TestSuite()
+    #suite.addTests(doctest.DocTestSuite(helloworld))
+    suite.addTests(test_pwman.suite())
+    return suite
+
+if __name__ == '__main__':
+    unittest.TextTestRunner(verbosity=2).run(suite())

+ 0 - 3
pwman/tests/db_tests.py

@@ -48,9 +48,6 @@ class DBTests(unittest.TestCase):
         self.dbtype = config.get_value("Database", "type")
         self.db = pwman.data.factory.create(self.dbtype, dbver)
 
-    def test(self):
-        self.assertTrue(True)
-
     def test_db_created(self):
         "test that the right db instance was created"
         # self.db = pwman.data.factory.create(dbtype, dbver)

+ 12 - 5
pwman/tests/test_pwman.py

@@ -64,8 +64,9 @@ try:
                                  'cls_timeout': '5'
                                  },
                       'Database': {'type': 'SQLite',
-                                   'filename': os.path.join("tests",
-                                                            "test.pwman.db")},
+                                   'filename':
+                                   os.path.join(os.path.dirname(__file__),
+                                   "test.pwman.db")},
                       'Encryption': {'algorithm': 'AES'},
                       'Readline': {'history': os.path.join("tests",
                                                            "history")}
@@ -121,8 +122,14 @@ except SystemExit, e:
 
 
 import unittest
-from db_tests import CLITests
 from db_tests import DBTests
-from crypto_tests import CryptoTest
+
+
+def suite():
+    loader = unittest.TestLoader()
+    suite = unittest.TestSuite()
+    suite.addTest(loader.loadTestsFromTestCase(DBTests))
+    return suite
+
 if __name__ == '__main__':
-    unittest.main()
+    unittest.TextTestRunner(verbosity=2).run(suite())

+ 2 - 2
pwman/ui/cli.py

@@ -886,11 +886,11 @@ class PwmanCliNew(PwmanCli):
         enc = CryptoEngine.get()
         if not enc.alive():
             enc._getcipher()
-        print "Tags: ",
+        print "Tags: \n",
         if len(tags) == 0:
             print "None",
         for t in tags:
-            print "%s " % t,
+            print enc.decrypt(t)
         print
 
     def get_tags(self, default=None):

+ 5 - 8
setup.py

@@ -3,11 +3,9 @@
 script to install pwman3
 """
 
-#from distutils.core import setup
-from setuptools import Command, setup
+from setuptools import setup
 import pwman
 
-
 setup(name=pwman.appname,
       version=pwman.version,
       description=pwman.description,
@@ -24,10 +22,9 @@ setup(name=pwman.appname,
       scripts=['scripts/pwman3'],
       zip_safe=False,
       install_requires=['pycrypto>=2.6',
-                'colorama>=0.2.4'],
+                        'colorama>=0.2.4'],
       classifiers=[
           'Environment :: Console',
-
           'Intended Audience :: End Users/Desktop',
           'Intended Audience :: Developers',
           'Intended Audience :: System Administrators',
@@ -37,6 +34,6 @@ setup(name=pwman.appname,
           'Operating System :: POSIX',
           'Programming Language :: Python',
           'Programming Language :: Python :: 2.7'
-          ],
-      test_suite="tests"
-)
+      ],
+      test_suite='pwman.tests'
+      )