import expect from '@kbn/expect' ; import { FtrProviderContext } from '../../ftr_provider_context' ; export default function ( { getService } ) { const supertest = getService ( 'supertest' ) ; describe ( 'Privileges registration' , function ( ) { this . tags ( [ 'skipCloud' ] ) ; it ( 'privileges are re-registered on license downgrade' , async ( ) => { const expectedTrialLicenseDiscoverPrivileges = [ 'all' , 'read' , 'minimal_all' , 'minimal_read' , 'url_create' , 'store_search_session' , ] ; const trialPrivileges = await supertest . get ( '/api/security/privileges' ) . set ( 'kbn-xsrf' , 'xxx' ) . send ( ) . expect ( 200 ) ; expect ( trialPrivileges . body . features . discover ) . to . eql ( expectedTrialLicenseDiscoverPrivileges ) ; await supertest . post ( '/api/license/start_basic?acknowledge=true' ) . set ( 'kbn-xsrf' , 'xxx' ) . expect ( 200 , { basic_was_started : true , acknowledged : true , } ) ; const expectedBasicLicenseDiscoverPrivileges = [ 'all' , 'read' , 'minimal_all' , 'minimal_read' ] ; const basicPrivileges = await supertest . get ( '/api/security/privileges' ) . set ( 'kbn-xsrf' , 'xxx' ) . send ( ) . expect ( 200 ) ; expect ( basicPrivileges . body . features . discover ) . to . eql ( expectedBasicLicenseDiscoverPrivileges ) ; } ) ; } ) ; }