def test_entries_with_empty_days(self): """Test method to fill sparse data with zero values so that we have entries for each day, starting from today to the oldest entry""" allentries = AllJenkinsDayEntries() dayentry = JenkinsDayEntry() dayentry.date = date.today() - timedelta(days=3) dayentry.tickets = ["XY-123", "XY-124"] allentries.add(dayentry) dayentry = JenkinsDayEntry() dayentry.date = date.today() - timedelta(days=2) dayentry.tickets = ["XY-111"] allentries.add(dayentry) self.assertEqual(len(allentries.entries_with_empty_days()), 4) self.assertEqual( allentries.entries_with_empty_days()[0].date, date.today() - timedelta(days=3) )
def main(): """Orchestrate our toolbox to run the Jenkins analysis""" argvdict = _parse_arguments() qjinstance = QueryJenkins() buildlist = qjinstance.get_builds( argvdict["server"], argvdict["jobname"], NUMBER_OF_PAST_BUILDS) allentries = AllJenkinsDayEntries() for build in buildlist: dayentry = JenkinsDayEntry() dayentry.date = build.get_timestamp().date() dayentry.tickets = qjinstance.get_ticket_tumbers(build) allentries.add(dayentry) per_day_values = allentries.entries_with_empty_days() qjinstance.export_as_excel_file("buildtickets.xlsx", per_day_values)