From 28079059caaea4db5d2a6e1e8855097fb04304b3 Mon Sep 17 00:00:00 2001 From: "Sascha L. Teichmann" Date: Wed, 27 Sep 2023 23:36:04 +0200 Subject: [PATCH] Add unit test for validation status --- cmd/csaf_downloader/forwarder_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 cmd/csaf_downloader/forwarder_test.go diff --git a/cmd/csaf_downloader/forwarder_test.go b/cmd/csaf_downloader/forwarder_test.go new file mode 100644 index 00000000..61d18f93 --- /dev/null +++ b/cmd/csaf_downloader/forwarder_test.go @@ -0,0 +1,26 @@ +// 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) +// Software-Engineering: 2023 Intevation GmbH + +package main + +import "testing" + +func TestValidationStatusUpdate(t *testing.T) { + sv := validValidationStatus + sv.update(invalidValidationStatus) + sv.update(validValidationStatus) + if sv != invalidValidationStatus { + t.Fatalf("got %q expected %q", sv, invalidValidationStatus) + } + sv = notValidatedValidationStatus + sv.update(validValidationStatus) + sv.update(notValidatedValidationStatus) + if sv != notValidatedValidationStatus { + t.Fatalf("got %q expected %q", sv, notValidatedValidationStatus) + } +}