def tasks_search(): """Provide/Choose search type Show search results """ while True: clear_screen() user_input = input(SEARCH).upper() clear_screen() if user_input == 'F': return None elif user_input == 'A': res = EmpSearch().search() elif user_input == 'B': res = DateSearch().search() elif user_input == 'C': res = TimeSearch().search() elif user_input == 'D': res = TermSearch().search() elif user_input == 'E': res = DateRangeSearch().search() else: print(TRY_AGAIN) continue create_result_list(res) show_results() reset_results()
def test_term_search(self): with patch('builtins.input', side_effect=['test']): res = task_search.TermSearch().search() task_search.reset_results() self.assertEqual(task_search.create_result_list(res), 1)
def test_date_search(self): with patch('builtins.input', side_effect=[self.test_tdate]): res = task_search.DateSearch().search() task_search.reset_results() self.assertEqual(task_search.create_result_list(res), 1)
def test_show_results_none_found(self): task_search.reset_results() self.assertEqual(task_search.show_results(), 0)
def test_show_results_return(self): res = Task.select().where(Task.employee_name == self.test_ename) task_search.reset_results() task_search.create_result_list(res) with patch('builtins.input', side_effect=['R']): self.assertEqual(task_search.show_results(), 1)
def test_date_range_search(self): with patch('builtins.input', side_effect=['1000-01-01', '1990-10-11']): res = task_search.DateRangeSearch().search() task_search.reset_results() self.assertEqual(task_search.create_result_list(res), 1)