Back to index

python-cliapp  1.20120630
Public Member Functions | Public Attributes
cliapp.app_tests.SubcommandTests Class Reference

List of all members.

Public Member Functions

def setUp
def test_lists_subcommands
def test_normalizes_subcommand
def test_raises_error_for_no_subcommand
def test_raises_error_for_unknown_subcommand
def test_calls_subcommand_method

Public Attributes

 app
 trash

Detailed Description

Definition at line 281 of file app_tests.py.


Member Function Documentation

Definition at line 283 of file app_tests.py.

00283 
00284     def setUp(self):
00285         self.app = DummySubcommandApp()
00286         self.trash = StringIO.StringIO()
        

Definition at line 302 of file app_tests.py.

00302 
00303     def test_calls_subcommand_method(self):
00304         self.app.run(['help'], stderr=self.trash, log=devnull)
00305         self.assert_(self.app.help_called)
00306 

Definition at line 287 of file app_tests.py.

00287 
00288     def test_lists_subcommands(self):
00289         self.assertEqual(self.app._subcommand_methodnames(), ['cmd_help'])

Definition at line 290 of file app_tests.py.

00290 
00291     def test_normalizes_subcommand(self):
00292         self.assertEqual(self.app._normalize_cmd('help'), 'cmd_help')
00293         self.assertEqual(self.app._normalize_cmd('foo-bar'), 'cmd_foo_bar')
        

Definition at line 294 of file app_tests.py.

00294 
00295     def test_raises_error_for_no_subcommand(self):
00296         self.assertRaises(SystemExit, self.app.run, [], 
00297                           stderr=self.trash, log=devnull)
        

Definition at line 298 of file app_tests.py.

00298 
00299     def test_raises_error_for_unknown_subcommand(self):
00300         self.assertRaises(SystemExit, self.app.run, ['what?'], 
00301                           stderr=self.trash, log=devnull)


Member Data Documentation

Definition at line 284 of file app_tests.py.

Definition at line 285 of file app_tests.py.


The documentation for this class was generated from the following file: