Skip to content

Commit

Permalink
[ML] Update common imports for delete dfa test
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 committed May 28, 2020
1 parent 1144296 commit f67115d
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions x-pack/test/api_integration/apis/ml/data_frame_analytics/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { USER } from '../../../../functional/services/machine_learning/security_common';
import { USER } from '../../../../functional/services/ml/security_common';
import { DataFrameAnalyticsConfig } from '../../../../../plugins/ml/public/application/data_frame_analytics/common';
import { DeepPartial } from '../../../../../plugins/ml/common/types/common';
const COMMON_HEADERS = {
'kbn-xsrf': 'some-xsrf-token',
};
import { COMMON_REQUEST_HEADERS } from '../../../../functional/services/ml/common';

export default ({ getService }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');
Expand Down Expand Up @@ -81,7 +79,7 @@ export default ({ getService }: FtrProviderContext) => {
const { body } = await supertest
.delete(`/api/ml/data_frame/analytics/${analyticsId}`)
.auth(USER.ML_POWERUSER, ml.securityCommon.getPasswordForUser(USER.ML_POWERUSER))
.set(COMMON_HEADERS)
.set(COMMON_REQUEST_HEADERS)
.expect(200);

expect(body.analyticsJobDeleted.success).to.eql(true);
Expand All @@ -93,7 +91,7 @@ export default ({ getService }: FtrProviderContext) => {
const { body } = await supertest
.delete(`/api/ml/data_frame/analytics/${analyticsId}`)
.auth(USER.ML_UNAUTHORIZED, ml.securityCommon.getPasswordForUser(USER.ML_UNAUTHORIZED))
.set(COMMON_HEADERS)
.set(COMMON_REQUEST_HEADERS)
.expect(404);

expect(body.error).to.eql('Not Found');
Expand All @@ -106,7 +104,7 @@ export default ({ getService }: FtrProviderContext) => {
const { body } = await supertest
.delete(`/api/ml/data_frame/analytics/${analyticsId}`)
.auth(USER.ML_VIEWER, ml.securityCommon.getPasswordForUser(USER.ML_VIEWER))
.set(COMMON_HEADERS)
.set(COMMON_REQUEST_HEADERS)
.expect(404);

expect(body.error).to.eql('Not Found');
Expand All @@ -118,7 +116,7 @@ export default ({ getService }: FtrProviderContext) => {
const { body } = await supertest
.delete(`/api/ml/data_frame/analytics/${jobId}_invalid`)
.auth(USER.ML_POWERUSER, ml.securityCommon.getPasswordForUser(USER.ML_POWERUSER))
.set(COMMON_HEADERS)
.set(COMMON_REQUEST_HEADERS)
.expect(404);

expect(body.error).to.eql('Not Found');
Expand All @@ -143,7 +141,7 @@ export default ({ getService }: FtrProviderContext) => {
.delete(`/api/ml/data_frame/analytics/${analyticsId}`)
.query({ deleteDestIndex: true })
.auth(USER.ML_POWERUSER, ml.securityCommon.getPasswordForUser(USER.ML_POWERUSER))
.set(COMMON_HEADERS)
.set(COMMON_REQUEST_HEADERS)
.expect(200);

expect(body.analyticsJobDeleted.success).to.eql(true);
Expand Down Expand Up @@ -172,7 +170,7 @@ export default ({ getService }: FtrProviderContext) => {
.delete(`/api/ml/data_frame/analytics/${analyticsId}`)
.query({ deleteDestIndexPattern: true })
.auth(USER.ML_POWERUSER, ml.securityCommon.getPasswordForUser(USER.ML_POWERUSER))
.set(COMMON_HEADERS)
.set(COMMON_REQUEST_HEADERS)
.expect(200);

expect(body.analyticsJobDeleted.success).to.eql(true);
Expand Down Expand Up @@ -204,7 +202,7 @@ export default ({ getService }: FtrProviderContext) => {
.delete(`/api/ml/data_frame/analytics/${analyticsId}`)
.query({ deleteDestIndex: true, deleteDestIndexPattern: true })
.auth(USER.ML_POWERUSER, ml.securityCommon.getPasswordForUser(USER.ML_POWERUSER))
.set(COMMON_HEADERS)
.set(COMMON_REQUEST_HEADERS)
.expect(200);

expect(body.analyticsJobDeleted.success).to.eql(true);
Expand Down

0 comments on commit f67115d

Please sign in to comment.