def search_by_time_spent(self): """search by time spent""" self.init_new_search() self.activestep = DialogStep( checkinput_func=self.check_time_spent, prompt="Please provide a time or time range in minutes" "\nsuch as '30' or '30 - 45")
def search_by_employee(self): """search by employee""" self.init_new_search() self.activestep = \ DialogStep( checkinput_func=self.check_employee, prompt="Please enter the name of an employee")
def prepare_delete(self): """delete""" self.activestep = \ DialogStep( checkinput_func=self.confirm_delete, prompt="[y]es to confirm delete, " "[f]orget to disregard delete request" )
def prepare_get_note(self): """ the get note step is prepared """ self.activestep = DialogStep( checkinput_func=self.ask_for_note_update, prompt="Note: [a] for accept as is\n" "or enter [c] to change." )
def prepare_get_time_spent(self): """ the get time spent step is prepared """ self.activestep = DialogStep( checkinput_func=self.get_time_spent, prompt="Time spent: [a] for accept as is\n" "or enter the time you spent in minutes" )
def prepare_get_task(self): """ the get task step is prepared """ self.activestep = DialogStep( checkinput_func=self.get_task, prompt="Task: [a] for accept as is\n" "or enter your task:" )
def get_first_dialogstep(self): """ the get name step is prepared """ return DialogStep( checkinput_func=self.get_name, prompt="Name: [a] for accept as is\n" "or enter your name:" )
def search_by_date(self): """search by date""" self.init_new_search() self.activestep = \ DialogStep( checkinput_func=self.check_date, prompt="Please provide a date or range of dates\n" "such as \n'30.8.2016' or \n'30.8.2016 - 2.9.2016\n" "or request [l]ist of available logdates")
def test_base_get_method_and_prompt_choice_true(self): """ choice has priority over active step: input method is input """ self.dialog.choice = True self.dialog.activestep = DialogStep() method, prompt = self.dialog.get_method_and_prompt() self.assertEqual(method, self.dialog.get_input_with_input) self.assertIsNotNone(prompt)
def test_base_get_method_and_prompt_no_choice_active_step_sys_input(self): """ if choice is false active step determines the input method """ self.dialog.choice = False self.dialog.activestep = DialogStep(input_method=sys.stdin.read) method, prompt = self.dialog.get_method_and_prompt() self.assertEqual(method, self.dialog.get_input_with_sys_stdin) self.assertIsNotNone(prompt)
def prepare_note_change(self): """ the not change step is prepared """ self.activestep = DialogStep( checkinput_func=self.get_note, prompt="Note: Please enter a note and exit with Ctrl D," "when you are finished.", input_method=sys.stdin.read )
def search_by_term(self): """search by term""" self.init_new_search() self.activestep = DialogStep(checkinput_func=self.check_term, prompt="Please provide a searchterm")