def test_out_all_sheets(self): expected_rows = [ ( 1, u'default', self.now, self.now, None, None ), ( 2, u'another_sheet', self.now, self.now, None, None ) ] args = [] cmds.in_(self.db_mock, args) cmds.switch(self.db_mock, ['another_sheet', ]) cmds.in_(self.db_mock, args) cmds.switch(self.db_mock, ['default', ]) cmds.out(self.db_mock, ['--all']) rows = self.get_entry_rows() self.assertEqual( rows, expected_rows )
def test_display(self): expected_rows = self.adjust_output_rows_for_time( [[ u'Day Start End Duration Notes Billable' ], [ u'{date}' + ' {time} - {time} ' + ' 00:00:00 some task yes' ], [u'{time} - ' + ' 00:00:00 some other task yes'], [u'00:00:00'], [u'Total 00:00:00']]) cmds.in_(self.db_mock, [ 'some task', ]) cmds.out(self.db_mock, []) cmds.in_(self.db_mock, [ 'some other task', ]) output = self.tabularize_output( self.capture_output(cmds.display, [ self.db_mock, self.arbitrary_args, ])) self.assertEqual( output, expected_rows, )
def test_display(self): expected_rows = self.adjust_output_rows_for_time([ [u'Day Start End Duration Notes Billable'], [u'{date}' + ' {time} - {time} ' +' 00:00:00 some task yes'], [u'{time} - ' + ' 00:00:00 some other task yes'], [u'00:00:00'], [u'Total 00:00:00'] ]) cmds.in_(self.db_mock, ['some task', ]) cmds.out(self.db_mock, []) cmds.in_(self.db_mock, ['some other task', ]) output = self.tabularize_output( self.capture_output( cmds.display, [ self.db_mock, self.arbitrary_args, ] ) ) self.assertEqual( output, expected_rows, )
def test_out(self): expected_rows = [(1, u'default', self.now, self.now, None, None)] args = [] cmds.in_(self.db_mock, args) cmds.out(self.db_mock, args) rows = self.get_entry_rows() self.assertEqual(rows, expected_rows)
def test_out(self): expected_rows = [(1, u"default", self.now, self.now, None, None)] args = [] cmds.in_(self.db_mock, args) cmds.out(self.db_mock, args) rows = self.get_entry_rows() self.assertEqual(rows, expected_rows)
def test_alter(self): original_name = "current task" later_name = "something else" expected_rows = [(1, u"default", self.now, None, later_name, None)] cmds.in_(self.db_mock, [original_name]) cmds.alter(self.db_mock, [later_name]) rows = self.get_entry_rows() self.assertEqual(rows, expected_rows)
def test_list_when_has_sheets(self): expected_rows = [[u'Timesheet Running Today Total time'], [u'*default -- 0:00:00 0:00:00']] cmds.in_(self.db_mock, ['arbitrary description']) output = self.capture_output(cmds.list, [ self.db_mock, self.arbitrary_args, ]) output = self.tabularize_output(output) self.assertEqual(output, expected_rows)
def test_in(self): arbitrary_description = "Some Description" expected_row = (1, self.default_sheet, self.now, None, arbitrary_description, None) args = [arbitrary_description] cmds.in_(self.db_mock, args) rows = self.get_entry_rows() self.assertEqual(rows, [expected_row])
def test_in(self): arbitrary_description = "Some Description" expected_row = (1, self.default_sheet, self.now, None, arbitrary_description, None) args = [arbitrary_description] cmds.in_(self.db_mock, args) rows = self.get_entry_rows() self.assertEqual(rows, [ expected_row, ])
def test_list_when_has_sheets(self): expected_rows = [ [u'Timesheet Running Today Total time'], [u'*default -- 0:00:00 0:00:00'] ] cmds.in_(self.db_mock, ['arbitrary description']) output = self.capture_output( cmds.list, [self.db_mock, self.arbitrary_args, ] ) output = self.tabularize_output(output) self.assertEqual( output, expected_rows )
def test_running(self): expected_rows = [[u'Timesheet Description'], [u'default some task']] cmds.in_(self.db_mock, [ 'some task', ]) output = self.tabularize_output( self.capture_output(cmds.running, [ self.db_mock, self.arbitrary_args, ])) self.assertEqual( output, expected_rows, )
def test_out_all_sheets(self): expected_rows = [ (1, u"default", self.now, self.now, None, None), (2, u"another_sheet", self.now, self.now, None, None), ] args = [] cmds.in_(self.db_mock, args) cmds.switch(self.db_mock, ["another_sheet"]) cmds.in_(self.db_mock, args) cmds.switch(self.db_mock, ["default"]) cmds.out(self.db_mock, ["--all"]) rows = self.get_entry_rows() self.assertEqual(rows, expected_rows)
def test_alter(self): original_name = 'current task' later_name = 'something else' expected_rows = [ (1, u'default', self.now, None, later_name, None), ] cmds.in_(self.db_mock, [ original_name, ]) cmds.alter(self.db_mock, [ later_name, ]) rows = self.get_entry_rows() self.assertEqual(rows, expected_rows)
def test_running(self): expected_rows = [ [u'Timesheet Description'], [u'default some task'] ] cmds.in_(self.db_mock, ['some task', ]) output = self.tabularize_output( self.capture_output(cmds.running, [ self.db_mock, self.arbitrary_args, ] ) ) self.assertEqual( output, expected_rows, )
def test_display(self): expected_rows = self.adjust_output_rows_for_time( [ [u"Day Start End Duration Notes Billable"], [u"{date}" + " {time} - {time} " + " 00:00:00 some task yes"], [u"{time} - " + " 00:00:00 some other task yes"], [u"00:00:00"], [u"Total 00:00:00"], ] ) cmds.in_(self.db_mock, ["some task"]) cmds.out(self.db_mock, []) cmds.in_(self.db_mock, ["some other task"]) output = self.tabularize_output(self.capture_output(cmds.display, [self.db_mock, self.arbitrary_args])) self.assertEqual(output, expected_rows)
def test_out_all_sheets(self): expected_rows = [(1, u'default', self.now, self.now, None, None), (2, u'another_sheet', self.now, self.now, None, None)] args = [] cmds.in_(self.db_mock, args) cmds.switch(self.db_mock, [ 'another_sheet', ]) cmds.in_(self.db_mock, args) cmds.switch(self.db_mock, [ 'default', ]) cmds.out(self.db_mock, ['--all']) rows = self.get_entry_rows() self.assertEqual(rows, expected_rows)
def test_alter(self): original_name = 'current task' later_name = 'something else' expected_rows = [ ( 1, u'default', self.now, None, later_name, None ), ] cmds.in_(self.db_mock, [original_name, ]) cmds.alter(self.db_mock, [later_name, ]) rows = self.get_entry_rows() self.assertEqual( rows, expected_rows )