def test_defaulitize_availability_with_empty_dict(self): self.assertEqual(defaulitize_availability({}), { 'fixed_closing_days': [], 'special_closing_days': [], 'week_working_hours': {}, 'special_working_hours': {}, })
def test_defaulitize_availability_filled_all(self): availability = { 'fixed_closing_days': [date(year=4, month=2, day=2)], 'special_closing_days': [date(year=2016, month=2, day=2)], 'week_working_hours': { 1: [(time(hour=9), time(hour=10))] }, 'special_working_hours': { date(year=1993, month=9, day=26): [ (time(hour=6), time(hour=7)), ], }, } self.assertEqual(defaulitize_availability(availability), availability)
def test_defaulitize_availability_filled_week_working_hours(self): self.assertEqual(defaulitize_availability({ 'week_working_hours': { 1: [(time(hour=9), time(hour=10))], 2: [(time(hour=9), time(hour=10))], } }), { 'fixed_closing_days': [], 'special_closing_days': [], 'week_working_hours': { 1: [(time(hour=9), time(hour=10))], 2: [(time(hour=9), time(hour=10))], }, 'special_working_hours': {}, })
def test_defaulitize_availability_filled_special_closing_days(self): self.assertEqual(defaulitize_availability({ 'special_closing_days': [ date(year=2016, month=2, day=2), date(year=2016, month=12, day=24), ], }), { 'fixed_closing_days': [], 'special_closing_days': [ date(year=2016, month=2, day=2), date(year=2016, month=12, day=24), ], 'week_working_hours': {}, 'special_working_hours': {}, })
def test_defaulitize_availability_filled_special_working_hours(self): self.assertEqual(defaulitize_availability({ 'special_working_hours': { date(year=2016, month=2, day=4): [ (time(hour=6), time(hour=7)), (time(hour=9), time(hour=12)), ] }, }), { 'fixed_closing_days': [], 'special_closing_days': [], 'week_working_hours': {}, 'special_working_hours': { date(year=2016, month=2, day=4): [ (time(hour=6), time(hour=7)), (time(hour=9), time(hour=12)), ] }, })