def test_store_multiple_per_day(self): """Multiple entries for a day should be grouped in one entry""" allentries = AllJenkinsDayEntries() dayentry = JenkinsDayEntry() dayentry.date = date(2016, 2, 8) dayentry.tickets = ["XY-123", "XY-124"] allentries.add(dayentry) dayentry = JenkinsDayEntry() dayentry.date = date(2016, 2, 8) dayentry.tickets = ["XY-111"] allentries.add(dayentry) self.assertEqual(len(allentries.alldays()), 1) self.assertEqual( allentries.alldays_as_string(), ["2016.02.08"] ) self.assertEqual(allentries.entries[0].num_tickets(), 3)
def test_storing_entries(self): """Verify storing JenkinsDayEntry instances""" allentries = AllJenkinsDayEntries() dayentry = JenkinsDayEntry() dayentry.date = date(2016, 2, 8) dayentry.tickets = ["XY-123", "XY-124"] allentries.add(dayentry) dayentry = JenkinsDayEntry() dayentry.date = date(2016, 2, 5) dayentry.tickets = ["XY-111"] allentries.add(dayentry) dayentry = JenkinsDayEntry() dayentry.date = date(2016, 2, 9) dayentry.tickets = ["XY-222", "XY-333", "XY-444"] allentries.add(dayentry) self.assertEqual(allentries.get(date(2016, 2, 9)), dayentry) self.assertEqual(len(allentries.alldays()), 3) self.assertEqual( allentries.alldays_as_string(), ["2016.02.08", "2016.02.05", "2016.02.09"] )