[7.x] Role Management - update index fields API to account for removed types (#35986) (#36015)

* update index fields API to account for removed types

* adds API test
This commit is contained in:
Larry Gregory 2019-05-03 09:04:51 -04:00 committed by GitHub
parent d17e1eaa2d
commit 88bb450637
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 1 deletions

View file

@ -24,7 +24,6 @@ export function initIndicesApi(server) {
.then((mappings) =>
_(mappings)
.map('mappings')
.map(_.values)
.flatten()
.map(_.keys)
.flatten()

View file

@ -9,6 +9,7 @@ export default function ({ loadTestFile }) {
this.tags('ciGroup6');
loadTestFile(require.resolve('./basic_login'));
loadTestFile(require.resolve('./index_fields'));
loadTestFile(require.resolve('./roles'));
loadTestFile(require.resolve('./privileges'));
});

View file

@ -0,0 +1,36 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import expect from '@kbn/expect/expect.js';
import { KibanaFunctionalTestDefaultProviders } from '../../../types/providers';
// eslint-disable-next-line import/no-default-export
export default function({ getService }: KibanaFunctionalTestDefaultProviders) {
const supertest = getService('supertest');
describe('Index Fields', () => {
describe('GET /api/security/v1/fields/{query}', () => {
it('should return a list of available index mapping fields', async () => {
await supertest
.get('/api/security/v1/fields/.kibana')
.set('kbn-xsrf', 'xxx')
.send()
.expect(200)
.then((response: Record<string, any>) => {
const sampleOfExpectedFields = [
'type',
'visualization.title',
'dashboard.title',
'search.columns',
'space.name',
];
sampleOfExpectedFields.forEach(field => expect(response.body).to.contain(field));
});
});
});
});
}