Compare commits
1 Commits
main
...
429_attach
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e2a440337 |
@ -322,6 +322,9 @@ func (c Mail) GetItem(
|
|||||||
// https://learn.microsoft.com/en-us/answers/questions/1227026/pagination-not-working-when-fetching-message-attac
|
// https://learn.microsoft.com/en-us/answers/questions/1227026/pagination-not-working-when-fetching-message-attac
|
||||||
logger.CtxErr(ctx, err).Info("fetching all attachments by id")
|
logger.CtxErr(ctx, err).Info("fetching all attachments by id")
|
||||||
|
|
||||||
|
// Clear expand params
|
||||||
|
attachConfig.QueryParameters.Expand = []string{}
|
||||||
|
|
||||||
// Getting size just to log in case of error
|
// Getting size just to log in case of error
|
||||||
attachConfig.QueryParameters.Select = idAnd("size")
|
attachConfig.QueryParameters.Select = idAnd("size")
|
||||||
|
|
||||||
|
|||||||
@ -370,6 +370,52 @@ func (suite *MailAPIIntgSuite) TestMail_attachmentListDownload() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *MailAPIIntgSuite) TestMail_GetAttachments() {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
messageID string
|
||||||
|
expect assert.ErrorAssertionFunc
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "Attachment for a given message ID",
|
||||||
|
messageID: "", // @vkamra insert message id here
|
||||||
|
expect: assert.NoError,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
suite.Run(test.name, func() {
|
||||||
|
t := suite.T()
|
||||||
|
|
||||||
|
ctx, flush := tester.NewContext(t)
|
||||||
|
defer flush()
|
||||||
|
|
||||||
|
item, _, err := suite.its.ac.Mail().GetItem(
|
||||||
|
ctx,
|
||||||
|
"", // @vkamra insert user id here
|
||||||
|
test.messageID,
|
||||||
|
false,
|
||||||
|
fault.New(true))
|
||||||
|
test.expect(t, err)
|
||||||
|
|
||||||
|
it, ok := item.(models.Messageable)
|
||||||
|
require.True(t, ok, "convert to messageable")
|
||||||
|
|
||||||
|
var size int64
|
||||||
|
|
||||||
|
if it.GetBody() != nil {
|
||||||
|
content := ptr.Val(it.GetBody().GetContent())
|
||||||
|
size = int64(len(content))
|
||||||
|
}
|
||||||
|
|
||||||
|
attachments := it.GetAttachments()
|
||||||
|
for _, attachment := range attachments {
|
||||||
|
size += int64(*attachment.GetSize())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (suite *MailAPIIntgSuite) TestMail_PostLargeAttachment() {
|
func (suite *MailAPIIntgSuite) TestMail_PostLargeAttachment() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user