def test_menu_loop_add_entree_and_exit(self): """tests if adding entry and then exiting works""" with self.assertRaises(SystemExit): with patch('builtins.input', side_effect=[ 'a', self.name, self.task, self.timespent, self.notes, 's', 'q' ]): log_book.menu_loop()
def test_menu_loop_valid_choice_loop(self): """tests if the choice is still valid after the security while loop for choice to be valid""" with self.assertRaises(SystemExit): with patch('builtins.input', side_effect=[ 'fk;adlsfjs;kf', 'k;fdlsf;ajsd;fkd', ';fdklsjf;ksaj', 'f;dlkf', 'q' ]): log_book.menu_loop()
def test_add_entree_with_negative_timespent_raise_error(self): """when adding an entree with a negative timespent checks if it raises error""" with self.assertRaises(SystemExit): with self.assertRaises(ValueError): with patch('builtins.input', side_effect=[ 'a', self.name, self.task, '-45', self.timespent, 'any note', 'r', 'q' ]): log_book.menu_loop()
def test_menu_loop_view_next_and_previous_and_exit(self): """testing next and previous options""" with self.assertRaises(SystemExit): with patch('builtins.input', side_effect=['v', 'n', 'p', 'r', 'q']): log_book.menu_loop()
def test_menu_loop_search_entree_by_term_in_tasks_and_notes(self): """tests searching entry by term in tasks and notes """ with self.assertRaises(SystemExit): with patch('builtins.input', side_effect=['s', 't', '', 'r', 'r', 'q']): log_book.menu_loop()
def test_menu_loop_search_entree_by_timespent_and_exit(self): """tests searching entry by timespent""" with self.assertRaises(SystemExit): with patch('builtins.input', side_effect=['s', 'ts', self.timespent, 'r', 'r', 'q']): log_book.menu_loop()
def test_menu_loop_search_entree_by_employee_and_exit(self): """tests searching entry by their name""" with self.assertRaises(SystemExit): with patch('builtins.input', side_effect=['s', 'n', self.name, 'r', 'r', 'q']): log_book.menu_loop()