From 6dbde1b5dfaa0d95bacac21b44b5f50e4bc13bd6 Mon Sep 17 00:00:00 2001 From: Jacob Kozol Date: Thu, 14 Nov 2019 16:59:27 +0100 Subject: [PATCH] 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. --- internal/weldr/api_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/internal/weldr/api_test.go b/internal/weldr/api_test.go index d4fa7baea..00d906afc 100644 --- a/internal/weldr/api_test.go +++ b/internal/weldr/api_test.go @@ -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