def _test_load_with_refresh_cred(self, refresh=True):
    cfg.CONF.set_override('deferred_auth_method', 'trusts')
    self.patchobject(self.ctx.auth_plugin, 'get_user_id', return_value='old_trustor_user_id')
    self.patchobject(self.ctx.auth_plugin, 'get_project_id', return_value='test_tenant_id')
    old_context = utils.dummy_context()
    old_context.trust_id = 'atrust123'
    old_context.trustor_user_id = ('trustor_user_id' if refresh else 'old_trustor_user_id')
    m_sc = self.patchobject(context, 'StoredContext')
    m_sc.from_dict.return_value = old_context
    self.stack = stack.Stack(self.ctx, 'test_regenerate_trust', self.tmpl)
    self.stack.store()
    load_stack = stack.Stack.load(self.ctx, stack_id=self.stack.id, check_refresh_cred=True)
    self.assertEqual(refresh, load_stack.refresh_cred)
def _test_load_with_refresh_cred(self, refresh=True):
    cfg.CONF.set_override('deferred_auth_method', 'trusts')
    self.patchobject(self.ctx.auth_plugin, 'get_user_id', return_value='old_trustor_user_id')
    self.patchobject(self.ctx.auth_plugin, 'get_project_id', return_value='test_tenant_id')
    old_context = utils.dummy_context()
    old_context.trust_id = 'atrust123'
    old_context.trustor_user_id = ('trustor_user_id' if refresh else 'old_trustor_user_id')
    m_sc = self.patchobject(context, 'StoredContext')
    m_sc.from_dict.return_value = old_context
    self.stack = stack.Stack(self.ctx, 'test_regenerate_trust', self.tmpl)
    self.stack.store()
    load_stack = stack.Stack.load(self.ctx, stack_id=self.stack.id, check_refresh_cred=True)
    self.assertEqual(refresh, load_stack.refresh_cred)