api/tests: add blueprint freeze test

This test creates a new blueprint with libsemanage. Libsemanage is
already in the mock rpmmd so when we test the freeze route on this
blueprint, the blueprint will properly depsolve and return the package
with the depsolved version.
This commit is contained in:
Jacob Kozol 2019-11-14 16:59:27 +01:00 committed by Tom Gundersen
parent c4088caee1
commit 6dbde1b5df

View file

@ -250,6 +250,24 @@ func TestBlueprintsInfo(t *testing.T) {
}
}
func TestBlueprintsFreeze(t *testing.T) {
var cases = []struct {
Fixture rpmmd_mock.Fixture
Path string
ExpectedStatus int
ExpectedJSON string
}{
{rpmmd_mock.BaseFixture, "/api/v0/blueprints/freeze/test", http.StatusOK, `{"blueprints":[{"blueprint":{"name":"test","description":"Test","version":"0.0.0","packages":[{"name":"libsemanage","version":"2.9-1.fc30.x86_64"}],"modules":[],"groups":[]}}],"errors":[]}`},
}
for _, c := range cases {
api, _ := createWeldrAPI(c.Fixture)
sendHTTP(api, true, "POST", "/api/v0/blueprints/new", `{"name":"test","description":"Test","packages":[{"name":"libsemanage","version":"*"}],"version":"0.0.0"}`)
testRoute(t, api, true, "GET", c.Path, ``, c.ExpectedStatus, c.ExpectedJSON)
sendHTTP(api, true, "DELETE", "/api/v0/blueprints/delete/test", ``)
}
}
func TestBlueprintsDiff(t *testing.T) {
var cases = []struct {
Method string