2023-05-25 17:43:44 +01:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
2024-06-11 14:50:38 +02:00
|
|
|
package client
|
2023-05-25 17:43:44 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-06-11 14:50:38 +02:00
|
|
|
"github.com/edgelesssys/constellation/v2/internal/api/attestationconfigapi"
|
2023-06-05 12:33:22 +02:00
|
|
|
"github.com/stretchr/testify/assert"
|
2023-05-25 17:43:44 +01:00
|
|
|
)
|
|
|
|
|
2023-06-05 12:33:22 +02:00
|
|
|
func TestDeleteAzureSEVSNPVersions(t *testing.T) {
|
|
|
|
sut := Client{
|
|
|
|
bucketID: "bucket",
|
|
|
|
}
|
2024-06-12 16:30:03 +02:00
|
|
|
versions := attestationconfigapi.List{List: []string{"2023-01-01.json", "2021-01-01.json", "2019-01-01.json"}}
|
2023-06-01 13:55:46 +02:00
|
|
|
|
2024-06-12 16:30:03 +02:00
|
|
|
ops, err := sut.deleteVersion(versions, "2021-01-01")
|
2023-05-25 17:43:44 +01:00
|
|
|
|
2023-06-05 12:33:22 +02:00
|
|
|
assert := assert.New(t)
|
|
|
|
assert.NoError(err)
|
|
|
|
assert.Contains(ops, deleteCmd{
|
2024-06-12 16:30:03 +02:00
|
|
|
apiObject: attestationconfigapi.Entry{
|
2023-06-05 12:33:22 +02:00
|
|
|
Version: "2021-01-01.json",
|
|
|
|
},
|
|
|
|
})
|
2023-05-25 17:43:44 +01:00
|
|
|
|
2023-06-05 12:33:22 +02:00
|
|
|
assert.Contains(ops, putCmd{
|
2024-06-12 16:30:03 +02:00
|
|
|
apiObject: attestationconfigapi.List{List: []string{"2023-01-01.json", "2019-01-01.json"}},
|
2023-06-05 12:33:22 +02:00
|
|
|
})
|
2023-05-25 17:43:44 +01:00
|
|
|
}
|