-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cases] limit number of attachments that can be created using the bulk create API #161451
Changes from 2 commits
dae86ec
b5c54de
c527881
a331315
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,17 +218,6 @@ export default ({ getService }: FtrProviderContext): void => { | |
}); | ||
}); | ||
|
||
it('should bulk create 100 file attachments when there is another attachment type in the request', async () => { | ||
const fileRequests = [...Array(100).keys()].map(() => getFilesAttachmentReq()); | ||
|
||
const postedCase = await createCase(supertest, postCaseReq); | ||
await bulkCreateAttachments({ | ||
supertest, | ||
caseId: postedCase.id, | ||
params: [postExternalReferenceSOReq, ...fileRequests], | ||
}); | ||
}); | ||
|
||
it('should bulk create 99 file attachments when the case has a file associated to it', async () => { | ||
const postedCase = await createCase( | ||
supertestWithoutAuth, | ||
|
@@ -376,6 +365,23 @@ export default ({ getService }: FtrProviderContext): void => { | |
}); | ||
}); | ||
|
||
it('400s when attempting to add more than 100 attachments', async () => { | ||
const comment = { | ||
type: CommentType.user, | ||
comment: 'test', | ||
owner: 'securitySolutionFixture', | ||
}; | ||
|
||
const attachments = Array(101).fill(comment); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In these integration tests I never know if I wanna just put the value or import the constant( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, but I thought it's good that integration tests fail when constant is changed, reminds us what all places we have put this check 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeps us on edge 😆 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Genau 😆 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😆 I tend to user the value for the reasons Janki mentioned. |
||
|
||
await bulkCreateAttachments({ | ||
supertest, | ||
caseId: 'test-case-id', | ||
params: attachments, | ||
expectedHttpCode: 400, | ||
}); | ||
}); | ||
|
||
it('400s when attempting to create a comment with a different owner than the case', async () => { | ||
const postedCase = await createCase( | ||
supertest, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove the
foo: 'bar'
field that is related to a different error? (I did the same mistake 😄 )