def test_store_saves_creds(self):
    'A user_creds entry is created on first stack store.'
    cfg.CONF.set_default('deferred_auth_method', 'password')
    self.stack = stack.Stack(self.ctx, 'creds_stack', self.tmpl)
    self.stack.store()
    db_stack = stack_object.Stack.get_by_id(self.ctx, self.stack.id)
    user_creds_id = db_stack.user_creds_id
    self.assertIsNotNone(user_creds_id)
    user_creds = ucreds_object.UserCreds.get_by_id(self.ctx, user_creds_id)
    self.assertEqual(self.ctx.username, user_creds.get('username'))
    self.assertEqual(self.ctx.password, user_creds.get('password'))
    self.assertIsNone(user_creds.get('trust_id'))
    self.assertIsNone(user_creds.get('trustor_user_id'))
    expected_context = context.RequestContext.from_dict(self.ctx.to_dict())
    expected_context.auth_token = None
    stored_context = self.stack.stored_context().to_dict()
    self.assertEqual(expected_context.to_dict(), stored_context)
    self.stack.store()
    self.assertEqual(user_creds_id, db_stack.user_creds_id)
A user_creds entry is created on first stack store.
def test_store_saves_creds(self):
    
    cfg.CONF.set_default('deferred_auth_method', 'password')
    self.stack = stack.Stack(self.ctx, 'creds_stack', self.tmpl)
    self.stack.store()
    db_stack = stack_object.Stack.get_by_id(self.ctx, self.stack.id)
    user_creds_id = db_stack.user_creds_id
    self.assertIsNotNone(user_creds_id)
    user_creds = ucreds_object.UserCreds.get_by_id(self.ctx, user_creds_id)
    self.assertEqual(self.ctx.username, user_creds.get('username'))
    self.assertEqual(self.ctx.password, user_creds.get('password'))
    self.assertIsNone(user_creds.get('trust_id'))
    self.assertIsNone(user_creds.get('trustor_user_id'))
    expected_context = context.RequestContext.from_dict(self.ctx.to_dict())
    expected_context.auth_token = None
    stored_context = self.stack.stored_context().to_dict()
    self.assertEqual(expected_context.to_dict(), stored_context)
    self.stack.store()
    self.assertEqual(user_creds_id, db_stack.user_creds_id)