示例#1
0
 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")
示例#2
0
 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")
示例#3
0
 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")
示例#4
0
 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")
示例#5
0
 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")
示例#6
0
 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")
示例#7
0
 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")
示例#8
0
 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")