def test_set_var_wrong_args(self): command.show_help(['test']).AndRaise(SystemExit) self.mox.ReplayAll() self.assertRaises(SystemExit, command.set_var, ['test'])
def test_main_catches(self): command.show_help(['test']).AndRaise(RuntimeError('catch me')) command.die('Failed: %s', mox.IsA(RuntimeError)) self.mox.ReplayAll() command.main(['test'])
def test_show_help(self): self.mox.StubOutWithMock(command, 'die') command.die(mox.IsA(basestring)) self.mox.ReplayAll() command.show_help(['test'])
def test_main_no_args(self): command.show_help(['test']).AndRaise(SystemExit) self.mox.ReplayAll() self.assertRaises(SystemExit, command.main, ['test'])