test_pwman.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env python
  2. #============================================================================
  3. # This file is part of Pwman3.
  4. #
  5. # Pwman3 is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License, version 2
  7. # as published by the Free Software Foundation;
  8. #
  9. # Pwman3 is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with Pwman3; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. #============================================================================
  18. # Copyright (C) 2012 Oz Nahum <nahumoz@gmail.com>
  19. #============================================================================
  20. # Copyright (C) 2006 Ivan Kelly <ivan@ivankelly.net>
  21. #============================================================================
  22. import os
  23. import sys
  24. import unittest
  25. from db_tests import (DBTests, SetupTester)
  26. from crypto_tests import CryptoTest
  27. # make sure we use local pwman
  28. sys.path.insert(0, os.getcwd())
  29. # check if old DB exists, if so remove it.
  30. # excuted only once when invoked upon import or
  31. # upon run
  32. SetupTester().clean()
  33. def suite():
  34. loader = unittest.TestLoader()
  35. suite = unittest.TestSuite()
  36. suite.addTest(loader.loadTestsFromTestCase(DBTests))
  37. suite.addTest(loader.loadTestsFromTestCase(CryptoTest))
  38. return suite
  39. if __name__ == '__main__':
  40. unittest.TextTestRunner(verbosity=2).run(suite())