def test_search_query_by_employee(self): employee = Employee.select().get() tasks = LogEntry.select().where(LogEntry.employee_id == employee.id) self.dialog.search_parameters = SearchParameters( employee_id=employee.id) self.dialog.query_by_employee() self.assertEqual(tasks, self.dialog.logentry_queryset)
def setUp(self): """ testdata is created and an employee is set up for the first test """ self.create_test_data() self.employee = Employee.select().get()
def setUp(self): """ the list is set up """ self.create_test_data() self.dialog = SearchDialog() self.dialog.active_choice_index = 1 employee_list = list(Employee.select()) self.employee = employee_list[1] self.dialog.choice_list = ChoiceList(list=employee_list)
def setUp(self): """ Szenario: temporary logentry has been build. the user can now decide what to do with it. """ self.create_test_data() self.dialog = CreateDialog() employee = Employee.select().get() self.dialog.logentry_tmp = { 'task': "some exotic task", 'time_spent': 20, 'note': "some note", 'employee': employee, }
def setUp(self): """ Szenario: temporary logentry has been build. the user can now decide what to do with it. """ self.create_test_data() self.logentry = LogEntry.select().get() data = {'logentry': self.logentry} self.dialog = UpdateDialog(**data) self.employee = Employee.select().get() self.dialog.logentry_tmp = { 'task': "some exotic task", 'time_spent': 20, 'note': "some note", 'employee': self.employee, } self.print_stack = ['some item'] self.print_logentries = _print_logentry_tmp(self.dialog.logentry_tmp, self.logentry)
def test_helpers__print_logentry_tmp_filled(self): """ print in case of create the filled out form """ with test_database(test_db, (Employee, LogEntry)): self.create_test_data() employee = Employee.select().get() logentry_tmp = { 'employee': employee, 'task': 'some task', 'time_spent': 30, 'note': 'some note', } printstring = _print_logentry_tmp(logentry_tmp=logentry_tmp, logentry=None) self.assertEqual(printstring, (("{0:<20s} {1}\n{2:<20s} {3}\n" "{4:<20s} {5} min\n{6}\n{7}").format( 'Employee:', employee, 'Task:', 'some task', 'Time spent:', 30, 'Note:', 'some note')))
def test_helpers__print_logentry_tmp_for_update(self): """ print in case of update: fields are taken from tmps and if they are not filled, from the database record """ with test_database(test_db, (Employee, LogEntry)): self.create_test_data() employee = Employee.select().get() logentry = LogEntry.select().get() logentry_tmp = { 'employee': employee, 'time_spent': 45, } printstring = _print_logentry_tmp(logentry_tmp=logentry_tmp, logentry=logentry) self.assertEqual( printstring, (("{0:<20s} {1}\n{2:<20s} {3}\n" "{4:<20s} {5} min\n{6}\n{7}").format( 'Employee:', employee, 'Task:', logentry.task, 'Time spent:', 45, 'Note:', logentry.note)))