'Test case for creating periodic task for cloud watch lite alarm.
If there is no cloud watch lite alarm, then DO create a periodic task
for it.'

@mock.patch.object(service_stack_watch.stack_object.Stack, 'get_all_by_owner_id')
@mock.patch.object(service_stack_watch.watch_rule_object.WatchRule, 'get_all_by_stack')
@mock.patch.object(service_stack_watch.watch_rule_object.WatchRule, 'update_by_id')
def test_periodic_watch_task_created(self, watch_rule_update, watch_rule_get_all_by_stack, stack_get_all_by_owner_id):

    stack_id = 86
    wr1 = mock.Mock()
    wr1.id = 4
    wr1.state = rpc_api.WATCH_STATE_NODATA
    watch_rule_get_all_by_stack.return_value = [wr1]
    stack_get_all_by_owner_id.return_value = []
    tg = mock.Mock()
    sw = service_stack_watch.StackWatch(tg)
    sw.start_watch_task(stack_id, self.ctx)
    self.assertEqual([mock.call(stack_id, sw.periodic_watcher_task, sid=stack_id)], tg.add_timer.call_args_list)
