mirror of
https://github.com/kubescape/kubescape.git
synced 2026-02-14 18:09:55 +00:00
This PR focuses on adding unit tests for multiple packages in the project. The main changes include: - Addition of new tests for the 'printer' package in the 'core/pkg/resultshandling/printer' directory. - New tests for the 'results' package in the 'core/pkg/resultshandling' directory. - Addition of tests for the 'config' package in the 'httphandler/config' directory. - New tests for the 'testutils' package in the 'internal/testutils' directory. - Addition of tests for the 'imagescan' package in the 'pkg/imagescan' directory. Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
54 lines
791 B
Go
54 lines
791 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSetAndGetAccessKey(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
key string
|
|
}{
|
|
{
|
|
name: "Non empty key",
|
|
key: "value1",
|
|
},
|
|
{
|
|
name: "Empty key",
|
|
key: "",
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
SetAccessKey(tt.key)
|
|
assert.Equal(t, tt.key, GetAccessKey())
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestSetAndGetAccount(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
account string
|
|
}{
|
|
{
|
|
name: "Non empty account",
|
|
account: "value1",
|
|
},
|
|
{
|
|
name: "Empty account",
|
|
account: "",
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
SetAccount(tt.account)
|
|
assert.Equal(t, tt.account, GetAccount())
|
|
})
|
|
}
|
|
}
|