From cd9338ae7279791db62e28e8f4b5cfe9cf370881 Mon Sep 17 00:00:00 2001 From: koplas <54645365+koplas@users.noreply.github.com> Date: Thu, 12 Sep 2024 15:54:42 +0200 Subject: [PATCH] Add initial download unittests --- cmd/csaf_downloader/downloader_test.go | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 cmd/csaf_downloader/downloader_test.go diff --git a/cmd/csaf_downloader/downloader_test.go b/cmd/csaf_downloader/downloader_test.go new file mode 100644 index 00000000..dac2e180 --- /dev/null +++ b/cmd/csaf_downloader/downloader_test.go @@ -0,0 +1,32 @@ +// This file is Free Software under the Apache-2.0 License +// without warranty, see README.md and LICENSES/Apache-2.0.txt for details. +// +// SPDX-License-Identifier: Apache-2.0 +// +// SPDX-FileCopyrightText: 2023 German Federal Office for Information Security (BSI) +// Software-Engineering: 2023 Intevation GmbH + +package main + +import ( + "context" + "log/slog" + "testing" + + "github.com/csaf-poc/csaf_distribution/v3/csaf" + "github.com/csaf-poc/csaf_distribution/v3/internal/options" +) + +func TestShaMarking(t *testing.T) { + cfg := config{LogLevel: &options.LogLevel{Level: slog.LevelDebug}} + cfg.prepare() + d, err := newDownloader(&cfg) + if err != nil { + t.Fatalf("could not init downloader: %v", err) + } + defer d.close() + ctx := context.Background() + files := []csaf.AdvisoryFile{} + + d.downloadFiles(ctx, csaf.TLPLabelWhite, files) +}