Test DELETE of index-patterns

This commit is contained in:
Matthew Bargar 2015-11-19 12:39:19 -05:00
parent 32768725df
commit d8d605bf74
2 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,43 @@
define(function (require) {
var Promise = require('bluebird');
var createTestData = require('intern/dojo/node!../../../unit/api/index_patterns/data');
var _ = require('intern/dojo/node!lodash');
var expect = require('intern/dojo/node!expect.js');
return function (bdd, scenarioManager, request) {
bdd.describe('DELETE index-patterns', function deleteIndexPatterns() {
bdd.beforeEach(function () {
return scenarioManager.reload('emptyKibana').then(function () {
return request.post('/index-patterns').send(createTestData().indexPatternWithMappings);
});
});
bdd.afterEach(function () {
return request.del('/index-patterns/logstash-*');
});
bdd.it('should return 200 for successful deletion of pattern and template', function () {
return request.del('/index-patterns/logstash-*')
.expect(200)
.then(function () {
return request.get('/index-patterns/logstash-*').expect(404);
})
.then(function () {
return scenarioManager.client.indices.getTemplate({name: 'kibana-logstash-*'})
.catch(function (error) {
expect(error.status).to.be(404);
});
});
});
bdd.it('should return 404 for a non-existent id', function () {
return request.del('/index-patterns/doesnotexist')
.expect(404);
});
});
};
});

View file

@ -9,6 +9,7 @@ define(function (require) {
var post = require('./_post');
var get = require('./_get');
var put = require('./_put');
var del = require('./_del');
bdd.describe('index-patterns API', function () {
var scenarioManager = new ScenarioManager(url.format(config.servers.elasticsearch));
@ -25,5 +26,6 @@ define(function (require) {
get(bdd, scenarioManager, request);
post(bdd, scenarioManager, request);
put(bdd, scenarioManager, request);
del(bdd, scenarioManager, request);
});
});