'Test stack_domain_user_token function.'

def test_stack_domain_user_token(self):

    dum_tok = 'dummytoken'
    ctx = utils.dummy_context()
    mock_ks_auth = self.m.CreateMockAnything()
    mock_ks_auth.get_token(mox.IsA(ks_session.Session)).AndReturn(dum_tok)
    self.patchobject(ctx, '_create_auth_plugin')
    m = ks_auth.Password(auth_url='http://server.test:5000/v3', password='apassw', project_id='aproject', user_id='duser')
    m.AndReturn(mock_ks_auth)
    self.m.ReplayAll()
    ctx.trust_id = None
    heat_ks_client = heat_keystoneclient.KeystoneClient(ctx)
    token = heat_ks_client.stack_domain_user_token(user_id='duser', project_id='aproject', password='apassw')
    self.assertEqual(dum_tok, token)
