import http from 'http' ; import getPort from 'get-port' ; import { FtrProviderContext } from '../../../../common/ftr_provider_context' ; import { getSlackServer } from '../../../../common/fixtures/plugins/actions_simulators/server/plugin' ; export default function slackTest ( { getService } ) { const supertest = getService ( 'supertest' ) ; describe ( 'slack action' , ( ) => { let slackSimulatorURL = '' ; let slackServer ; before ( async ( ) => { slackServer = await getSlackServer ( ) ; const availablePort = await getPort ( { port : 9000 } ) ; slackServer . listen ( availablePort ) ; slackSimulatorURL = `http://localhost:${ availablePort }` ; } ) ; it ( 'should return 403 when creating a slack action' , async ( ) => { await supertest . post ( '/api/actions/action' ) . set ( 'kbn-xsrf' , 'foo' ) . send ( { name : 'A slack action' , actionTypeId : '.slack' , secrets : { webhookUrl : slackSimulatorURL , } , } ) . expect ( 403 , { statusCode : 403 , error : 'Forbidden' , message : 'Action type .slack is disabled because your basic license does not support it. Please upgrade your license.' , } ) ; } ) ; after ( ( ) => { slackServer . close ( ) ; } ) ; } ) ; }