test_complete_ui.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #============================================================================
  2. # This file is part of Pwman3.
  3. #
  4. # Pwman3 is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License, version 2
  6. # as published by the Free Software Foundation;
  7. #
  8. # Pwman3 is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with Pwman3; if not, write to the Free Software
  15. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. #============================================================================
  17. # Copyright (C) 2012-2014 Oz Nahum <nahumoz@gmail.com>
  18. #============================================================================
  19. # pylint: disable=I0011
  20. import pexpect
  21. import unittest
  22. import os
  23. OLD_DB_PATH = os.path(os.path.dirname(__file__), 'pwman.db.v0.0.8')
  24. _db_warn = ("\n*** WARNNING: You are using the old database format"
  25. " which is insecure."
  26. " Please upgrade to the new database "
  27. " format. Do note: support for this DB format will be dropped in"
  28. " v0.5. This database format is on hold. No bugs are fixead"
  29. " Check the help (pwman3 -h) or look at the manpage which"
  30. " explains how to proceed. ***")
  31. class Ferrum(unittest.TestCase):
  32. def test_db_warning(self):
  33. "when trying to run with old db, we should see warning"
  34. child = pexpect.spawn('../../scripts/pwman3 -t -d '+OLD_DB_PATH)
  35. def suite():
  36. loader = unittest.TestLoader()
  37. suite = unittest.TestSuite()
  38. suite.addTest(loader.loadTestsFromTestCase(Ferrum))
  39. return suite
  40. if __name__ == '__main__':
  41. unittest.TextTestRunner(verbosity=2).run(suite())