import { FtrProviderContext } from '../../../../common/ftr_provider_context' ; import { getExternalServiceSimulatorPath , ExternalServiceSimulator , } from '../../../../common/fixtures/plugins/actions_simulators/server/plugin' ; export default function resilientTest ( { getService } ) { const supertest = getService ( 'supertest' ) ; const kibanaServer = getService ( 'kibanaServer' ) ; const mockResilient = { config : { apiUrl : 'www.resilientisinkibanaactions.com' , orgId : '201' , } , secrets : { apiKeyId : 'elastic' , apiKeySecret : 'changeme' , } , params : { incident : { name : 'a title' , description : 'a description' , incidentTypes : [ 1001 ] , severityCode : 'High' , } , comments : [ { commentId : '456' , comment : 'first comment' , } , ] , } , } ; describe ( 'resilient' , ( ) => { let resilientSimulatorURL = '<could not determine kibana url>' ; before ( ( ) => { resilientSimulatorURL = kibanaServer . resolveUrl ( getExternalServiceSimulatorPath ( ExternalServiceSimulator . RESILIENT ) ) ; } ) ; it ( 'should return 403 when creating a resilient action' , async ( ) => { await supertest . post ( '/api/actions/action' ) . set ( 'kbn-xsrf' , 'foo' ) . send ( { name : 'A resilient action' , actionTypeId : '.resilient' , config : { apiUrl : resilientSimulatorURL , } , secrets : mockResilient . secrets , } ) . expect ( 403 , { statusCode : 403 , error : 'Forbidden' , message : 'Action type .resilient is disabled because your basic license does not support it. Please upgrade your license.' , } ) ; } ) ; } ) ; }