def test_stack_eager_or_lazy_load_templ(self):
    self.stack = stack.Stack(self.ctx, 'test_stack_eager_or_lazy_tmpl', self.tmpl)
    self.stack.store()
    ctx1 = utils.dummy_context()
    s1_db_result = db_api.stack_get(ctx1, self.stack.id, eager_load=True)
    s1_obj = stack_object.Stack._from_db_object(ctx1, stack_object.Stack(), s1_db_result)
    self.assertIsNotNone(s1_obj._raw_template)
    self.assertIsNotNone(s1_obj.raw_template)
    ctx2 = utils.dummy_context()
    s2_db_result = db_api.stack_get(ctx2, self.stack.id, eager_load=False)
    s2_obj = stack_object.Stack._from_db_object(ctx2, stack_object.Stack(), s2_db_result)
    self.assertFalse(hasattr(s2_obj, '_raw_template'))
    self.assertIsNotNone(s2_obj.raw_template)
    self.assertIsNotNone(s2_obj._raw_template)
def test_stack_eager_or_lazy_load_templ(self):
    self.stack = stack.Stack(self.ctx, 'test_stack_eager_or_lazy_tmpl', self.tmpl)
    self.stack.store()
    ctx1 = utils.dummy_context()
    s1_db_result = db_api.stack_get(ctx1, self.stack.id, eager_load=True)
    s1_obj = stack_object.Stack._from_db_object(ctx1, stack_object.Stack(), s1_db_result)
    self.assertIsNotNone(s1_obj._raw_template)
    self.assertIsNotNone(s1_obj.raw_template)
    ctx2 = utils.dummy_context()
    s2_db_result = db_api.stack_get(ctx2, self.stack.id, eager_load=False)
    s2_obj = stack_object.Stack._from_db_object(ctx2, stack_object.Stack(), s2_db_result)
    self.assertFalse(hasattr(s2_obj, '_raw_template'))
    self.assertIsNotNone(s2_obj.raw_template)
    self.assertIsNotNone(s2_obj._raw_template)