Example #1
0
def soup_today():
    foods = store_food_list.get_all_food()
    day = DAYS_OF_THE_WEEK[datetime.date.today().weekday()]
    if foods is None:
        message = "No soups available today. Is it a weekend?"
    else:
        eat_soups = "...or...".join((foods["eat"]["soups"][day][0], foods["eat"]["soups"][day][1]))
        message = "At EAT there is: %s" % eat_soups
        pret_soups = "...or...".join((foods["pret"]["soups"][day][0], foods["pret"]["soups"][day][1]))
        message2 = "At Pret there is: %s" % pret_soups
        message = message, message2
    return message
Example #2
0
    def test_get_foods_for_day(self):
        all_food = store_food_list.get_all_food()
        found_vendors = all_food.keys()
        current_vendors = [ 'nusa',
                            'pret',
                            'eat',
                            'subway'
                           ]
        current_vendors += ["today_tm_wday"]

        # Check vendors exist + today's day as a number
        self.assertEqual(sorted(found_vendors), sorted(current_vendors))

        days_of_week = settings.days_of_the_week
        days_of_week.remove('saturday')
        days_of_week.remove('sunday')

        # Pret
        pret_soups = all_food['pret']['soups']
        pret_soup_days = pret_soups.keys()
        self.assertEqual(sorted(pret_soup_days), sorted(days_of_week),
                        'expected: days of the week for Pret Soups')

        # Eat
        eat_soups = all_food['eat']['soups']
        eat_soup_days = eat_soups.keys()
        self.assertEqual(sorted(eat_soup_days), sorted(days_of_week),
                        'expected: days of the week for Eat Soups')

        # Nusa
        full_days_of_week = settings.days_of_the_week
        nusa_soups = all_food['nusa']['soups']
        day_for_nusa_soup = nusa_soups.keys()[0]
        today_as_digit = datetime.datetime.now().weekday()
        today_as_day = full_days_of_week[today_as_digit]
        self.assertEqual(day_for_nusa_soup, today_as_day,
                        'expected: Nusa to have one day - today\'s soup')

        # test today_tm_wday
        self.assertEqual(all_food['today_tm_wday'], today_as_digit)
Example #3
0
def pies_today():
    foods = store_food_list.get_all_food()
    message = ", ".join(foods["pret"]["pies"])
    return message