Skip to content

Commit

Permalink
Add update test
Browse files Browse the repository at this point in the history
  • Loading branch information
criamico committed Oct 20, 2021
1 parent da8863e commit c10685f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions x-pack/test/fleet_api_integration/apis/package_policy/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,36 @@ export default function (providerContext: FtrProviderContext) {
.expect(500);
});

it('should return a 500 if there is another package policy with the same name on a different policy', async function () {
const { body: agentPolicyResponse } = await supertest
.post(`/api/fleet/agent_policies`)
.set('kbn-xsrf', 'xxxx')
.send({
name: 'Test policy',
namespace: 'default',
});
const otherAgentPolicyId = agentPolicyResponse.item.id;

await supertest
.put(`/api/fleet/package_policies/${packagePolicyId2}`)
.set('kbn-xsrf', 'xxxx')
.send({
name: 'filetest-1',
description: '',
namespace: 'updated_namespace',
policy_id: otherAgentPolicyId,
enabled: true,
output_id: '',
inputs: [],
package: {
name: 'filetest',
title: 'For File Tests',
version: '0.1.0',
},
})
.expect(500);
});

it('should work with frozen input vars', async function () {
await supertest
.put(`/api/fleet/package_policies/${packagePolicyId}`)
Expand Down

0 comments on commit c10685f

Please sign in to comment.