def test_last_none(self): """ returns first 5 sorted tenants with length 5 and todays date """ self.assertEqual( get_todays_tenants(self.tenants, self.today, None, None), (self.tenants[:5], 5, self.today))
def test_previous_day(self): """ Same as `test_same_day` """ next_day = datetime(1970, 1, 3) self.assertEqual( get_todays_tenants(self.tenants, self.today, 3, next_day), (self.tenants[:3], 3, self.today))
def test_next_day(self): """ returns tenants with 5 more for next day """ prev_day = datetime(1970, 1, 1) self.assertEqual( get_todays_tenants(self.tenants, self.today, 3, prev_day), (self.tenants[:8], 8, self.today))
def test_all(self): """ returns all tenants for new day if < 5 tenants are remaining since last time """ prev_day = datetime(1970, 1, 1) self.assertEqual( get_todays_tenants(self.tenants, self.today, 7, prev_day), (self.tenants, 10, self.today))
def test_same_day(self): """ returns same tenants as last time if asked within same day """ today = self.today.replace(hour=13, minute=20) last_date = self.today self.assertEqual( get_todays_tenants(self.tenants, today, 3, last_date), (self.tenants[:3], 3, last_date))