weldr: Add support for the v1 API to /projects/source/new

This commit changes the store.PushSource function to take the key as
well as the SourceConfig so that it can be used for v0 or v1.

It adds helper functions for decoding the toml/json into a new
SourceConfig interface type which lets the core source/new code be
shared between the versions.

It also adds tests for the new API behavior.
This commit is contained in:
Brian C. Lane 2020-04-29 15:29:17 -07:00 committed by Tom Gundersen
parent 55325a8549
commit ddd2010815
6 changed files with 304 additions and 32 deletions

View file

@ -112,7 +112,8 @@ func TestSourcesCommands(t *testing.T) {
require.NoErrorf(t, err, "Could not create temporary file: %v", err)
defer os.Remove(sources_toml.Name())
_, err = sources_toml.Write([]byte(`name = "osbuild-test-addon-source"
_, err = sources_toml.Write([]byte(`id = "osbuild-test-addon-source"
name = "Testing sources add command"
url = "file://REPO-PATH"
type = "yum-baseurl"
proxy = "https://proxy-url/"