def test_sort_retourne_vide(self, mock_print, mock_open): with patch.object(sys, 'argv', [pypodo, sort]): sort(mock_open) self.assertEqual( escape_ansi(mock_print.getvalue().rstrip('\n')), "warning : the todolist is empty - nothing to do")
def test_sort_if_todo_empty(self, mock_print, mock_open, mock_isfile): with patch.object(sys, 'argv', [pypodo, sort]): mock_isfile.return_value = True sort(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip( '\n')), "warning : the todolist is empty - nothing to do")
def test_sort_with_parameters_return_error(self, mock_print, mock_open): with patch.object(sys, 'argv', [pypodo, sort, "toto"]): sort(mock_open) self.assertEqual(escape_ansi(mock_print.getvalue().rstrip('\n')), "error : 0 parameter is needed for pypodo sort")
def test_sort_if_todo_with_tasks(self, mock_open, mock_isfile): with patch.object(sys, 'argv', [pypodo, sort]): mock_isfile.return_value = True sort(mock_open) mock_open().write.assert_called_with('2 ma seconde tache')