mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Many unittests for internal folder
This commit is contained in:
parent
24151345f5
commit
a217f88ea1
10 changed files with 506 additions and 0 deletions
28
internal/misc/mime_test.go
Normal file
28
internal/misc/mime_test.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// This file is Free Software under the MIT License
|
||||
// without warranty, see README.md and LICENSES/MIT.txt for details.
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// SPDX-FileCopyrightText: 2023 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de>
|
||||
// Software-Engineering: 2023 Intevation GmbH <https://intevation.de>
|
||||
|
||||
package misc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"bytes"
|
||||
"mime/multipart"
|
||||
)
|
||||
|
||||
|
||||
// CreateFormFile creates an [io.Writer] like [mime/multipart.Writer.CreateFromFile].
|
||||
// This version allows to set the mime type, too.
|
||||
func TestCreateFormFile( t *testing.T) {
|
||||
body := new(bytes.Buffer)
|
||||
writer := multipart.NewWriter(body)
|
||||
|
||||
_, err := CreateFormFile(writer, "csaf", "data", "application/json")
|
||||
if err != nil {
|
||||
t.Errorf("failed to create an io.Writer via CreateFormFile")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue