mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Test DELETE of index-patterns
This commit is contained in:
parent
32768725df
commit
d8d605bf74
2 changed files with 45 additions and 0 deletions
43
test/unit/api/index_patterns/_del.js
Normal file
43
test/unit/api/index_patterns/_del.js
Normal 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);
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
});
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue