def test_ask_confirm_with_message_wrong_output(self, capsys):
     sys.stdin = StringIO(u'foo\nyes')
     assert CliDialogHelper.ask_for_confirm_with_message('bar',
                                                         'baz') is True
     assert 'You have to choose' in capsys.readouterr()[0]  #stdout
 def test_ask_confirm_with_message_result(self, choice, expected):
     sys.stdin = StringIO(choice)
     assert CliDialogHelper.ask_for_confirm_with_message('foo',
                                                         'bar') is expected
 def test_ask_confirm_with_message_output(self, capsys):
     sys.stdin = StringIO(u'y')
     CliDialogHelper.ask_for_confirm_with_message('foo', 'bar')
     stdout, stderr = capsys.readouterr()
     assert 'foo' in stdout
     assert 'bar' in stdout
 def test_ask_confirm_eof_error(self):
     CliDialogHelper.inp = self.eofraiser
     assert CliDialogHelper.ask_for_confirm_with_message('bar',
                                                         'baz') is None
 def test_ask_confirm_eof_error(self):
     CliDialogHelper.inp = self.eofraiser
     assert CliDialogHelper.ask_for_confirm_with_message('bar', 'baz') is None
 def test_ask_confirm_with_message_wrong_output(self, capsys):
     sys.stdin = StringIO(u'foo\nyes')
     assert CliDialogHelper.ask_for_confirm_with_message('bar', 'baz') is True
     assert 'You have to choose' in capsys.readouterr()[0] #stdout
 def test_ask_confirm_with_message_output(self, capsys):
     sys.stdin = StringIO(u'y')
     CliDialogHelper.ask_for_confirm_with_message('foo', 'bar')
     stdout, stderr = capsys.readouterr()
     assert 'foo' in stdout
     assert 'bar' in stdout
 def test_ask_confirm_with_message_result(self, choice, expected):
     sys.stdin = StringIO(choice)
     assert CliDialogHelper.ask_for_confirm_with_message('foo', 'bar') is expected