Browse Source

Integrate complete ui test in the general suite

oz123 11 years ago
parent
commit
aa7982a29e
2 changed files with 10 additions and 2 deletions
  1. 5 2
      pwman/tests/test_complete_ui.py
  2. 5 0
      pwman/tests/test_pwman.py

+ 5 - 2
pwman/tests/test_complete_ui.py

@@ -37,12 +37,15 @@ class Ferrum(unittest.TestCase):
 
     def test_db_warning(self):
         "when trying to run with old db, we should see warning"
-        child = pexpect.spawn('../../scripts/pwman3 -t -d '+OLD_DB_PATH)
+        child = pexpect.spawn(os.path.join(os.path.dirname(__file__),
+                                           '../../scripts/pwman3')+' -t -d '+OLD_DB_PATH)
         self.assertEqual(0, child.expect_exact(_db_warn, timeout=0.5))
 
     def test_run_convert(self):
         "invoke pwman with -k option to convert the old data"
-        child = pexpect.spawn('../../scripts/pwman3 -t -k -d '+OLD_DB_PATH)
+        child = pexpect.spawn(os.path.join(os.path.dirname(__file__),
+                                           '../../scripts/pwman3')+' -t -k -d '+OLD_DB_PATH)
+        #child = pexpect.spawn('../../scripts/pwman3 -t -k -d '+OLD_DB_PATH)
         child.expect('[\s|\S]+Please enter your password:', timeout=0.5)
         self.assertEqual(6, child.sendline('12345'))
         rv = child.expect_exact(('\r\npwman successfully converted the old database '

+ 5 - 0
pwman/tests/test_pwman.py

@@ -25,6 +25,10 @@ from db_tests import (DBTests, SetupTester, CLITests, ConfigTest,
                       TestDBFalseConfig, FactoryTest)
 
 from crypto_tests import CryptoTest
+from test_complete_ui import Ferrum, NEW_DB_PATH
+
+if os.path.exists(NEW_DB_PATH):
+    os.remove(NEW_DB_PATH)
 
 # make sure we use local pwman
 sys.path.insert(0, os.getcwd())
@@ -43,6 +47,7 @@ def suite():
     suite.addTest(loader.loadTestsFromTestCase(ConfigTest))
     suite.addTest(loader.loadTestsFromTestCase(FactoryTest))
     suite.addTest(loader.loadTestsFromTestCase(TestDBFalseConfig))
+    suite.addTest(loader.loadTestsFromTestCase(Ferrum))
     return suite
 
 if __name__ == '__main__':