test_help.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/python -tt
  2. # vim: ai ts=4 sts=4 et sw=4
  3. #
  4. # Copyright (c) 2012 Intel, Inc.
  5. #
  6. # This program is free software; you can redistribute it and/or modify it
  7. # under the terms of the GNU General Public License as published by the Free
  8. # Software Foundation; version 2 of the License
  9. #
  10. # This program is distributed in the hope that it will be useful, but
  11. # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  12. # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  13. # for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License along
  16. # with this program; if not, write to the Free Software Foundation, Inc., 59
  17. # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. """Functionality tests for gbs help."""
  19. import unittest
  20. import imp
  21. from nose.tools import eq_
  22. GBS = imp.load_source("gbs", "./tools/gbs").main
  23. class TestHelp(unittest.TestCase):
  24. """Test help output of gbs commands"""
  25. @staticmethod
  26. def test_subcommand_help():
  27. """Test running gbs help with all possible subcommands."""
  28. for sub in [ "build", "lb", "remotebuild", "rb", "changelog", "ch",
  29. "submit", "sr", "export", "ex", "import", "im",
  30. "chroot", "chr"]:
  31. try:
  32. print '>>>sub', sub
  33. GBS(argv=["gbs", sub, "--help"])
  34. except SystemExit, err:
  35. eq_(err.code, 0)
  36. @staticmethod
  37. def test_help():
  38. """Test running gbs --help and gbs help."""
  39. try:
  40. GBS(argv=["gbs", "--help"])
  41. except SystemExit, err:
  42. eq_(err.code, 0)