diff options
author | Guido Günther <agx@sigxcpu.org> | 2013-06-26 17:15:19 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-06-26 18:18:32 +0200 |
commit | a5aff11ba22a5b2f2c56d3325f431d51681e6c9b (patch) | |
tree | 3417d73fb0eddf7aa64591ed0b0e2b4873ef4673 /tests/16_test_supercommand.py | |
parent | 375014db7fa3981b1b0e071013fb365a3840b32d (diff) |
Consistently call gbp the supercommand
and robustify against invalid modules names.
Diffstat (limited to 'tests/16_test_supercommand.py')
-rw-r--r-- | tests/16_test_supercommand.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/16_test_supercommand.py b/tests/16_test_supercommand.py new file mode 100644 index 00000000..5a9f0374 --- /dev/null +++ b/tests/16_test_supercommand.py @@ -0,0 +1,42 @@ +# vim: set fileencoding=utf-8 : +# (C) 2013 Guido Günther <agx@sigxcpu.org> +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +"""Test L{gbp} command wrapper""" + +import unittest +import gbp.scripts.supercommand + +class TestSuperCommand(unittest.TestCase): + + def test_import(self): + self.assertRaises(ImportError, + gbp.scripts.supercommand.import_command, + 'not.allowed') + self.assertRaises(ImportError, + gbp.scripts.supercommand.import_command, + 'not/allowed') + self.assertRaises(ImportError, + gbp.scripts.supercommand.import_command, + '0notallowed') + + def test_invalid_command(self): + """Test if we can import a valid command""" + self.assertEqual(gbp.scripts.supercommand.supercommand( + ['argv0', 'asdf']), 2) + + def test_missing_arg(self): + self.assertEqual(gbp.scripts.supercommand.supercommand( + ['argv0']), 1) + |