def test_list_TAG_retourne_empty_avec_deux_parametres( self, mock_print, mock_open): with patch.object(sys, 'argv', [pypodo, list, 'test', 'pe']): list(mock_open) mock_open.assert_called_with(STR_PATH_HOME__TODO_, 'r') self.assertEqual(escape_ansi(mock_print.getvalue().rstrip('\n')), 'warning : the filtered todolist is empty')
def test_list_TAG_retourne_une_tache_avec_un_tag(self, mock_print, mock_open): with patch.object(sys, 'argv', [pypodo, list, 'test']): list(mock_open) mock_open.assert_called_with(STR_PATH_HOME__TODO_, 'r') self.assertEqual(escape_ansi(mock_print.getvalue().rstrip('\n')), '1 ma tache #test')
def test_list_TAG_retourne_une_tache_avec_deux_parametres( self, mock_print, mock_open): with patch.object(sys, 'argv', [pypodo, list, 'test', 'linux']): list(mock_open) mock_open.assert_called_with(STR_PATH_HOME__TODO_, 'r') self.assertEqual(escape_ansi(mock_print.getvalue().rstrip('\n')), '3 ma troisieme tache #linux #test')
def test_list_with_double_filter_one_task_return_empty(self, mock_print, mock_open, mock_isfile): with patch.object(sys, 'argv', [pypodo, list, 'test', 'pe']): mock_isfile.return_value = True list(mock_open) mock_open.assert_called_with(STR_PATH_HOME__TODO_, 'r') self.assertEqual(escape_ansi( mock_print.getvalue().rstrip('\n')), 'warning : the filtered todolist is empty')
def test_list_with_double_filter_one_task(self, mock_print, mock_open, mock_isfile): with patch.object(sys, 'argv', [pypodo, list, 'test', 'linux']): mock_isfile.return_value = True list(mock_open) mock_open.assert_called_with(STR_PATH_HOME__TODO_, 'r') self.assertEqual(escape_ansi( mock_print.getvalue().rstrip('\n')), '3 ma troisieme tache #linux #test')
def test_list_if_todo_one_task(self, mock_print, mock_open, mock_isfile): with patch.object(sys, 'argv', [pypodo, list]): mock_isfile.return_value = True list(mock_open) mock_open.assert_called_with(STR_PATH_HOME__TODO_, 'r') self.assertEqual(escape_ansi( mock_print.getvalue().rstrip('\n')), '1 ma tache')
def test_list_retourne_vide(self, mock_print, mock_open): with patch.object(sys, 'argv', [pypodo, list]): list(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip('\n')), "warning : the todolist is empty")
def test_list_if_todo_empty(self, mock_print, mock_open, mock_isfile): with patch.object(sys, 'argv', [pypodo, list]): mock_isfile.return_value = True list(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip( '\n')), "warning : the todolist is empty")
def test_sort_if_todo_with_invalids_tasks(self, mock_print, mock_open, mock_isfile): with patch.object(sys, 'argv', [pypodo, list]): mock_isfile.return_value = True list(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip( '\n')), "warning : this line has not a valid format in .todo - 1 ma tache #te#st\nwarning : this line has not a valid format in .todo - a ma seconde tache\nerror : verify the .todo file")