示例#1
0
 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)
示例#2
0
 def test_getter_none(self):
     schedule_time = ScheduleTime(weekdays=None)
     assert_that(schedule_time.week_days, contains(
         1,
         2,
         3,
         4,
         5,
         6,
         7,
     ))
示例#3
0
 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,
                 ))
示例#4
0
 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,
         ))
示例#5
0
 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'))
示例#6
0
 def test_getter_none(self):
     schedule_time = ScheduleTime(hours=None)
     assert_that(schedule_time.hours_end, equal_to(None))
示例#7
0
 def test_setter(self):
     schedule_time = ScheduleTime(hours_end='08:15')
     assert_that(schedule_time.hours, equal_to('-08:15'))
示例#8
0
 def test_getter(self):
     schedule_time = ScheduleTime(hours='07:15-08:15')
     assert_that(schedule_time.hours_end, equal_to('08:15'))
示例#9
0
 def test_getter_no_hours_start(self):
     schedule_time = ScheduleTime(hours='-08:15')
     assert_that(schedule_time.hours_end, equal_to('08:15'))
示例#10
0
 def test_setter_none(self):
     schedule_time = ScheduleTime(months_list=None)
     assert_that(schedule_time.months, equal_to(None))
示例#11
0
 def test_setter(self):
     schedule_time = ScheduleTime(hours_start='07:15')
     assert_that(schedule_time.hours, equal_to('07:15'))
示例#12
0
 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'))
示例#13
0
 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))
示例#14
0
 def test_getter_no_type(self):
     schedule = ScheduleTime(action=':hangup')
     assert_that(schedule.subtype, equal_to('hangup'))
示例#15
0
 def test_getter_none(self):
     schedule = ScheduleTime(action=None)
     assert_that(schedule.subtype, equal_to(None))
示例#16
0
 def test_setter(self):
     schedule = ScheduleTime(type='user')
     assert_that(schedule.action, equal_to('user'))
示例#17
0
 def test_getter_no_subtype(self):
     schedule = ScheduleTime(action='user')
     assert_that(schedule.type, equal_to('user'))
示例#18
0
 def test_getter(self):
     schedule = ScheduleTime(action='endcall:hangup')
     assert_that(schedule.type, equal_to('endcall'))
示例#19
0
 def test_setter_none(self):
     schedule_time = ScheduleTime(hours_end=None)
     assert_that(schedule_time.hours, equal_to(''))
示例#20
0
 def add_schedule_time(self, **kwargs):
     schedule_time = ScheduleTime(**kwargs)
     self.add_me(schedule_time)
     return schedule_time
示例#21
0
 def test_setter(self):
     schedule = ScheduleTime(subtype='hangup')
     assert_that(schedule.action, equal_to(':hangup'))
示例#22
0
 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'))
示例#23
0
 def test_setter_none(self):
     schedule_time = ScheduleTime(week_days=None)
     assert_that(schedule_time.weekdays, equal_to(None))
示例#24
0
 def test_setter_when_type(self):
     schedule = ScheduleTime(type='endcall', subtype='hangup')
     assert_that(schedule.action, equal_to('endcall:hangup'))
示例#25
0
 def test_setter_none(self):
     schedule = ScheduleTime(subtype=None)
     assert_that(schedule.action, equal_to(''))
示例#26
0
 def create_object(self, data):
     return ScheduleTime(**data)