mirror of
https://github.com/elastic/kibana.git
synced 2025-06-29 03:24:45 -04:00
* Use Serializable from package * Rename to align with core * fix * more replacements * docssss * fix * Move it to @kbn/utility-types and remove core export * buildy build * tests Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
import expect from '@kbn/expect';
|
|
import { JsonObject } from '@kbn/utility-types';
|
|
import { FtrProviderContext } from '../../common/ftr_provider_context';
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
|
export default function annotationApiTests({ getService }: FtrProviderContext) {
|
|
const supertest = getService('supertest');
|
|
|
|
function request({ method, url, data }: { method: string; url: string; data?: JsonObject }) {
|
|
switch (method.toLowerCase()) {
|
|
case 'post':
|
|
return supertest.post(url).send(data).set('kbn-xsrf', 'foo');
|
|
|
|
default:
|
|
throw new Error(`Unsupported methoed ${method}`);
|
|
}
|
|
}
|
|
|
|
describe('Observability annotations with a basic license', () => {
|
|
describe('when creating an annotation', () => {
|
|
it('fails with a 403 forbidden', async () => {
|
|
const response = await request({
|
|
url: '/api/observability/annotation',
|
|
method: 'POST',
|
|
data: {
|
|
annotation: {
|
|
type: 'deployment',
|
|
},
|
|
'@timestamp': new Date().toISOString(),
|
|
message: 'test message',
|
|
tags: ['apm'],
|
|
},
|
|
});
|
|
|
|
expect(response.status).to.be(403);
|
|
expect(response.body.message).to.be(
|
|
'Annotations require at least a gold license or a trial license.'
|
|
);
|
|
});
|
|
});
|
|
});
|
|
}
|