tests: test for blueprint.GetPackages()

This also tests Package with "*" specified as version
This commit is contained in:
Jakub Rusz 2020-03-23 17:13:10 +01:00 committed by Tom Gundersen
parent 4c39223497
commit 833e798f1b

View file

@ -2,6 +2,7 @@ package blueprint
import (
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
"testing"
)
@ -89,3 +90,20 @@ func TestBumpVersion(t *testing.T) {
}
}
}
func TestGetPackages(t *testing.T) {
bp := Blueprint{
Name: "packages-test",
Description: "Testing GetPackages function",
Version: "0.0.1",
Packages: []Package{
{Name: "tmux", Version: "1.2"}},
Modules: []Package{
{Name: "openssh-server", Version: "*"}},
Groups: []Group{
{Name: "anaconda-tools"}},
}
Received_packages := bp.GetPackages()
assert.ElementsMatch(t, []string{"tmux-1.2", "openssh-server", "@anaconda-tools"}, Received_packages)
}