From 8f6b4c0815b83e14abb846bca04e9d50f6eba179 Mon Sep 17 00:00:00 2001 From: rkhaybulin Date: Mon, 24 Apr 2023 11:48:29 +0300 Subject: [PATCH] [ISSUE-86] support xlsx files in attachments --- pkg/allure/attachment.go | 4 +++- pkg/allure/attachment_test.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/allure/attachment.go b/pkg/allure/attachment.go index d4f0aa3..8412f7f 100644 --- a/pkg/allure/attachment.go +++ b/pkg/allure/attachment.go @@ -43,7 +43,8 @@ const ( Webm MimeType = "video/webm" Mpeg MimeType = "video/mpeg" - Pdf MimeType = "application/pdf" + Pdf MimeType = "application/pdf" + Xlsx MimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ) var mimeTypeMap = map[MimeType]string{ @@ -67,6 +68,7 @@ var mimeTypeMap = map[MimeType]string{ Webm: "webm", Mpeg: "mpeg", Pdf: "pdf", + Xlsx: "xlsx", } // NewAttachment - Constructor. Returns pointer to new attachment object. diff --git a/pkg/allure/attachment_test.go b/pkg/allure/attachment_test.go index 792c1fd..eed4a94 100644 --- a/pkg/allure/attachment_test.go +++ b/pkg/allure/attachment_test.go @@ -85,6 +85,7 @@ func TestMimeTypeMap(t *testing.T) { Webm: "webm", Mpeg: "mpeg", Pdf: "pdf", + Xlsx: "xlsx", } assert.Equal(t, len(_mimeTypeMap), len(mimeTypeMap), "Miss Some!") for _type, _format := range _mimeTypeMap { @@ -152,5 +153,8 @@ func TestMimeTypeMap(t *testing.T) { var _Pdf MimeType = "application/pdf" assert.Equal(t, _Pdf, Pdf) + + var _Xlsx MimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + assert.Equal(t, _Xlsx, Xlsx) }) }