Ejemplo n.º 1
0
    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,
                )
Ejemplo n.º 2
0
    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,
        )
Ejemplo n.º 3
0
    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
                )
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    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)
Ejemplo n.º 7
0
    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)
Ejemplo n.º 8
0
    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)