Esempio n. 1
0
 def test_choose_from_list_1(self, ask_mock):
     """Verify no choice given with no field_set options."""
     field = basic.choose_from_list(set())
     with self.subTest():
         self.assertFalse(ask_mock.called)
     with self.subTest():
         self.assertIsNone(field)
Esempio n. 2
0
 def test_choose_from_list_2(self, ask_mock):
     """Verify first field is selected."""
     ask_mock.side_effect = [True]
     field = basic.choose_from_list(self.options)
     with self.subTest():
         self.assertTrue(ask_mock.called)
     with self.subTest():
         self.assertEqual(field, "note")
Esempio n. 3
0
 def test_choose_from_list_6(self, ask_mock):
     """Verify exit after three "no" responses."""
     ask_mock.side_effect = [False, False, False]
     field = basic.choose_from_list(self.options)
     self.assertIsNone(field)
Esempio n. 4
0
 def test_choose_from_list_5(self, ask_mock):
     """Verify exit after one "no" response and one "exit" response."""
     ask_mock.side_effect = [False, None]
     field = basic.choose_from_list(self.options)
     self.assertIsNone(field)
Esempio n. 5
0
 def test_choose_from_list_3(self, ask_mock):
     """Verify second field is selected after one "no" response."""
     ask_mock.side_effect = [False, True]
     field = basic.choose_from_list(self.options)
     self.assertEqual(field, "function")