def test_reload_no_schedule_in_opts(self): ''' Tests reloading the schedule from saved schedule that does not contain a schedule key and neither does self.schedule.opts ''' saved = {'foo': 'bar'} ret = {'schedule': {'foo': 'bar'}} Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_schedule_in_saved_but_not_opts(self): ''' Tests reloading the schedule from saved schedule that contains a schedule key, but self.schedule.opts does not ''' saved = {'schedule': {'foo': 'bar'}} ret = {'schedule': {'schedule': {'foo': 'bar'}}} Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_update_schedule_key(self): ''' Tests reloading the schedule from saved schedule where both the saved schedule and self.schedule.opts contain a schedule key ''' saved = {'schedule': {'foo': 'bar'}} ret = {'schedule': {'foo': 'bar', 'hello': 'world'}} self.schedule.opts = {'schedule': {'hello': 'world'}} Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_update_schedule_no_key(self): ''' Tests reloading the schedule from saved schedule that does not contain a schedule key but self.schedule.opts does not ''' saved = {'foo': 'bar'} ret = {'schedule': {'foo': 'bar', 'hello': 'world'}} self.schedule.opts = {'schedule': {'hello': 'world'}} Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_no_schedule_in_opts(self): ''' Tests reloading the schedule from saved schedule that does not contain a schedule key and neither does self.schedule.opts ''' saved = {'foo': 'bar'} ret = copy.deepcopy(self.schedule.opts) ret['schedule'] = {'foo': 'bar'} self.schedule.opts.pop('schedule', None) Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_schedule_in_saved_but_not_opts(self): ''' Tests reloading the schedule from saved schedule that contains a schedule key, but self.schedule.opts does not ''' saved = {'schedule': {'foo': 'bar'}} ret = copy.deepcopy(self.schedule.opts) ret['schedule'] = {'foo': 'bar'} self.schedule.opts.pop('schedule', None) Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_update_schedule_key(self): """ Tests reloading the schedule from saved schedule where both the saved schedule and self.schedule.opts contain a schedule key """ saved = {"schedule": {"foo": "bar"}} ret = copy.deepcopy(self.schedule.opts) ret.update({"schedule": {"foo": "bar", "hello": "world"}}) self.schedule.opts.update({"schedule": {"hello": "world"}}) Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_update_schedule_no_key(self): """ Tests reloading the schedule from saved schedule that does not contain a schedule key but self.schedule.opts does """ saved = {"foo": "bar"} ret = copy.deepcopy(self.schedule.opts) ret.update({"schedule": {"foo": "bar", "hello": "world"}}) self.schedule.opts.update({"schedule": {"hello": "world"}}) Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_no_schedule_in_opts(self): """ Tests reloading the schedule from saved schedule that does not contain a schedule key and neither does self.schedule.opts """ saved = {"foo": "bar"} ret = copy.deepcopy(self.schedule.opts) ret["schedule"] = {"foo": "bar"} self.schedule.opts.pop("schedule", None) Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_schedule_in_saved_but_not_opts(self): """ Tests reloading the schedule from saved schedule that contains a schedule key, but self.schedule.opts does not """ saved = {"schedule": {"foo": "bar"}} ret = copy.deepcopy(self.schedule.opts) ret["schedule"] = {"foo": "bar"} self.schedule.opts.pop("schedule", None) Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_update_schedule_no_key(self): ''' Tests reloading the schedule from saved schedule that does not contain a schedule key but self.schedule.opts does ''' saved = {'foo': 'bar'} ret = copy.deepcopy(self.schedule.opts) ret.update({'schedule': {'foo': 'bar', 'hello': 'world'}}) self.schedule.opts.update({'schedule': {'hello': 'world'}}) Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_update_schedule_key(self): ''' Tests reloading the schedule from saved schedule where both the saved schedule and self.schedule.opts contain a schedule key ''' saved = {'schedule': {'foo': 'bar'}} ret = copy.deepcopy(self.schedule.opts) ret.update({'schedule': {'foo': 'bar', 'hello': 'world'}}) self.schedule.opts.update({'schedule': {'hello': 'world'}}) Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)
def test_reload_no_schedule_in_opts(self): ''' Tests reloading the schedule from saved schedule that does not contain a schedule key and neither does self.schedule.opts ''' saved = copy.deepcopy(DEFAULT_CONFIG) saved.update({'schedule': {'foo': 'bar'}}) ret = copy.deepcopy(DEFAULT_CONFIG) ret.update({'schedule': {'foo': 'bar'}}) Schedule.reload(self.schedule, saved) self.assertEqual(self.schedule.opts, ret)