def test_find_regex_retourne_one_element(self, mock_print, mock_open): with patch.object(sys, 'argv', [pypodo, find, "li.+x"]): find(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip('\n')), "3 ma seconde tache #linux")
def test_find_retourne_one_element(self, mock_print, mock_open): with patch.object(sys, 'argv', [pypodo, find, "ma tache "]): find(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip('\n')), "1 ma tache #test")
def test_find_retourne_erreur(self, mock_print, mock_open): with patch.object(sys, 'argv', [pypodo, find]): find(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip('\n')), "error : 1 parameter is needed for pypodo find")
def test_find_retourne_empty(self, mock_print, mock_open): with patch.object(sys, 'argv', [pypodo, find, "toto"]): find(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip('\n')), "warning : the filtered todolist is empty")
def test_list_if_no_file(self, mock_print, mock_open, mock_isfile): mock_isfile.return_value = False with patch.object(sys, 'argv', [pypodo, find, "li.+x"]): find(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip( '\n')), "info : creating .todolist file\nwarning : the filtered todolist is empty")
def test_find_regex_if_one_task(self, mock_print, mock_open, mock_isfile): with patch.object(sys, 'argv', [pypodo, find, "li.+x"]): mock_isfile.return_value = True find(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip( '\n')), "3 ma seconde tache #linux")
def test_find_if_one_task(self, mock_print, mock_open, mock_isfile): with patch.object(sys, 'argv', [pypodo, find, "ma tache "]): mock_isfile.return_value = True find(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip( '\n')), "1 ma tache #test")
def test_find_no_parameter_return_error(self, mock_print, mock_open, mock_isfile): with patch.object(sys, 'argv', [pypodo, find]): mock_isfile.return_value = True find(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip( '\n')), "error : 1 parameter is needed for pypodo find")