weldr: Add check for deleting system sources

It was passing it through to the non-system delete function
and not returning an error. This checks for system repos first and
returns a 400, SystemSource error response if it is in the system list.
This commit is contained in:
Brian C. Lane 2020-05-27 15:37:42 -07:00 committed by Tom Gundersen
parent 37258803b4
commit e37b513560
2 changed files with 24 additions and 6 deletions

View file

@ -526,7 +526,7 @@ func TestDeleteSystemSourcesV0(t *testing.T) {
// try removing system source
resp, err := DeleteSourceV0(testState.socket, repo_name)
require.NoError(t, err, "DELETE source failed with a client error")
require.True(t, resp.Status, "DELETE source failed: %#v", resp)
require.False(t, resp.Status, "DELETE system source test failed: %#v", resp)
// verify that system sources are still there
list, api, err := ListSourcesV0(testState.socket)
@ -552,7 +552,7 @@ func TestDeleteSystemSourcesV1(t *testing.T) {
// try removing system source
resp, err := DeleteSourceV1(testState.socket, repo_name)
require.NoError(t, err, "DELETE source failed with a client error")
require.True(t, resp.Status, "DELETE source failed: %#v", resp)
require.False(t, resp.Status, "DELETE system source test failed: %#v", resp)
// verify that system sources are still there
list, api, err := ListSourcesV1(testState.socket)