def test_yesno_choose_default_overriden(self): """Default is No""" yes_callback = Mock() no_callback = Mock() inter = YesNo("Content?", yes_callback, no_callback, default_is_yes=True) inter.choose("") self.assertTrue(yes_callback.called) self.assertFalse(no_callback.called)
def test_yesno_run_answers(self): """Yes runs yes in different ways""" yes_callback = Mock() no_callback = Mock() inter = YesNo("Content?", yes_callback, no_callback) self.assertEquals(inter.choose(choice_id=0), yes_callback.return_value) self.assertEquals(inter.choose(choice_id=1), no_callback.return_value) self.assertEquals(inter.choose(answer='Y'), yes_callback.return_value) self.assertEquals(inter.choose(answer='N'), no_callback.return_value) self.assertEquals(inter.choose(answer='yEs'), yes_callback.return_value) self.assertEquals(inter.choose(answer='nO'), no_callback.return_value)