'Test getting ec2 credential by access.'

def test_get_ec2_keypair_access(self):

    user_id = 'atestuser'
    self._stubs_auth(user_id=user_id)
    ctx = utils.dummy_context()
    ctx.trust_id = None
    self._mock_credential_list(user_id=user_id)
    self.m.ReplayAll()
    heat_ks_client = heat_keystoneclient.KeystoneClient(ctx)
    ec2_cred = heat_ks_client.get_ec2_keypair(access='access2')
    self.assertEqual('credential_id2', ec2_cred.id)
    self.assertEqual('access2', ec2_cred.access)
    self.assertEqual('secret2', ec2_cred.secret)
