def test_tag_grouped_duration(self, mocked_stdout): trackerian.print_summary(None) self.assertIn('03:00:00', mocked_stdout.getvalue())
def test_tag_grouped_percentage_printed(self, mocked_stdout): trackerian.print_summary(None) self.assertIn('25.00%', mocked_stdout.getvalue())
def test_tags_grouping_case_insensitive(self, mocked_stdout): trackerian.print_summary(None) printed = mocked_stdout.getvalue() self.assertFalse('UPPER' in printed and 'upper' in printed)
def test_tags_printed_title_case(self, mocked_stdout): trackerian.print_summary(None) self.assertIn('Upper', mocked_stdout.getvalue())
def test_name_grouped_percentage_printed(self, mocked_duration, mocked_stdout): mocked_duration.return_value = datetime.timedelta(minutes=15) trackerian.print_summary(None) # Activity 3 given 15 min current duration (20%) self.assertIn('20.00%', mocked_stdout.getvalue())
def test_earlier_than_range_start_datetime_ignored(self, mocked_stdout): date_range_start = datetime.datetime.now() trackerian.Activity('Alone') trackerian.print_summary(date_range_start) self.assertNotIn('30Minutes', mocked_stdout.getvalue())
def test_name_grouped_duration_shown(self, mocked_duration, mocked_stdout): mocked_duration.return_value = datetime.timedelta(minutes=60) trackerian.print_summary(None) # Activity 3 given 1 min current duration so total isn't same as name self.assertIn('01:00:00', mocked_stdout.getvalue())
def test_name_grouping_case_insensitive(self, mocked_stdout): trackerian.Activity('30MINUTES') trackerian.print_summary(None) word_count = collections.Counter(mocked_stdout.getvalue().split()) self.assertTrue(word_count['30MINUTES'] == 0)
def test_activities_grouped_by_name(self, mocked_stdout): trackerian.Activity('30Minutes') trackerian.print_summary(None) word_count = collections.Counter(mocked_stdout.getvalue().split()) self.assertTrue(word_count['30Minutes'] == 1)
def test_prints_total_time(self, mocked_duration, mocked_stdout): mocked_duration.return_value = datetime.timedelta(minutes=15) trackerian.print_summary(None) self.assertIn('01:15:00', mocked_stdout.getvalue())
def test_prints_number_of_tracked(self, mocked_stdout): trackerian.print_summary(None) self.assertIn('Activities Tracked: 3', mocked_stdout.getvalue())