def create_object(self, data): if 'destination' in data: data['type'] = data['destination'].get('type') data['subtype'] = data['destination'].get('subtype') data['actionarg1'] = data['destination'].get('actionarg1') data['actionarg2'] = data['destination'].get('actionarg2') data.pop('destination') return ScheduleTime(**data)
def test_getter_none(self): schedule_time = ScheduleTime(weekdays=None) assert_that(schedule_time.week_days, contains( 1, 2, 3, 4, 5, 6, 7, ))
def test_getter_none(self): schedule_time = ScheduleTime(months=None) assert_that(schedule_time.months_list, contains( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ))
def test_getter_none(self): schedule_time = ScheduleTime(monthdays=None) assert_that( schedule_time.month_days, contains( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, ))
def test_setter_when_hours_start(self): schedule_time = ScheduleTime(hours_start='07:15', hours_end='08:15') assert_that(schedule_time.hours, equal_to('07:15-08:15'))
def test_getter_none(self): schedule_time = ScheduleTime(hours=None) assert_that(schedule_time.hours_end, equal_to(None))
def test_setter(self): schedule_time = ScheduleTime(hours_end='08:15') assert_that(schedule_time.hours, equal_to('-08:15'))
def test_getter(self): schedule_time = ScheduleTime(hours='07:15-08:15') assert_that(schedule_time.hours_end, equal_to('08:15'))
def test_getter_no_hours_start(self): schedule_time = ScheduleTime(hours='-08:15') assert_that(schedule_time.hours_end, equal_to('08:15'))
def test_setter_none(self): schedule_time = ScheduleTime(months_list=None) assert_that(schedule_time.months, equal_to(None))
def test_setter(self): schedule_time = ScheduleTime(hours_start='07:15') assert_that(schedule_time.hours, equal_to('07:15'))
def test_setter_mix_range(self): schedule_time = ScheduleTime(week_days=[1, 3, 5, 6]) assert_that(schedule_time.weekdays, equal_to('1,3,5,6'))
def test_getter_mix_range(self): schedule_time = ScheduleTime(monthdays='1,4-7,10') assert_that(schedule_time.month_days, contains(1, 4, 5, 6, 7, 10))
def test_getter_no_type(self): schedule = ScheduleTime(action=':hangup') assert_that(schedule.subtype, equal_to('hangup'))
def test_getter_none(self): schedule = ScheduleTime(action=None) assert_that(schedule.subtype, equal_to(None))
def test_setter(self): schedule = ScheduleTime(type='user') assert_that(schedule.action, equal_to('user'))
def test_getter_no_subtype(self): schedule = ScheduleTime(action='user') assert_that(schedule.type, equal_to('user'))
def test_getter(self): schedule = ScheduleTime(action='endcall:hangup') assert_that(schedule.type, equal_to('endcall'))
def test_setter_none(self): schedule_time = ScheduleTime(hours_end=None) assert_that(schedule_time.hours, equal_to(''))
def add_schedule_time(self, **kwargs): schedule_time = ScheduleTime(**kwargs) self.add_me(schedule_time) return schedule_time
def test_setter(self): schedule = ScheduleTime(subtype='hangup') assert_that(schedule.action, equal_to(':hangup'))
def test_setter_mix_range(self): schedule_time = ScheduleTime(months_list=[1, 3, 5, 6]) assert_that(schedule_time.months, equal_to('1,3,5,6'))
def test_setter_none(self): schedule_time = ScheduleTime(week_days=None) assert_that(schedule_time.weekdays, equal_to(None))
def test_setter_when_type(self): schedule = ScheduleTime(type='endcall', subtype='hangup') assert_that(schedule.action, equal_to('endcall:hangup'))
def test_setter_none(self): schedule = ScheduleTime(subtype=None) assert_that(schedule.action, equal_to(''))
def create_object(self, data): return ScheduleTime(**data)