weldr: Fix out of range index for missing toml blueprint freeze

The API was crashing if the freeze request was called on a non-existent
blueprint. This changes it to return an empty string, matching
lorax-composer's behavior (since the output is toml it shouldn't return
json).
This commit is contained in:
Brian C. Lane 2020-08-03 16:10:32 -07:00 committed by Tom Gundersen
parent 55c86afaa6
commit be2ce10b75
2 changed files with 7 additions and 1 deletions

View file

@ -351,6 +351,7 @@ func TestBlueprintsFreeze(t *testing.T) {
ExpectedTOML string
}{
{rpmmd_mock.BaseFixture, "/api/v0/blueprints/freeze/test?format=toml", http.StatusOK, "name=\"test\"\n description=\"Test\"\n version=\"0.0.1\"\n groups = []\n [[packages]]\n name=\"dep-package1\"\n version=\"1.33-2.fc30.x86_64\"\n [[packages]]\n name=\"dep-package3\"\n version=\"7:3.0.3-1.fc30.x86_64\"\n [[modules]]\n name=\"dep-package2\"\n version=\"2.9-1.fc30.x86_64\""},
{rpmmd_mock.BaseFixture, "/api/v0/blueprints/freeze/missing?format=toml", http.StatusOK, ""},
}
for _, c := range cases {