api: Add TOML support for workspace POST
composer-cli pushes blueprints to the workspace using TOML not JSON. This also adds a test.
This commit is contained in:
parent
8781d41da6
commit
8c19364b65
2 changed files with 36 additions and 5 deletions
|
|
@ -101,7 +101,7 @@ version = "2.4.*"`
|
|||
}
|
||||
}
|
||||
|
||||
func TestBlueprintsWorkspace(t *testing.T) {
|
||||
func TestBlueprintsWorkspaceJSON(t *testing.T) {
|
||||
var cases = []struct {
|
||||
Method string
|
||||
Path string
|
||||
|
|
@ -119,6 +119,29 @@ func TestBlueprintsWorkspace(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestBlueprintsWorkspaceTOML(t *testing.T) {
|
||||
blueprint := `
|
||||
name = "test"
|
||||
description = "Test"
|
||||
version = "0.0.0"
|
||||
|
||||
[[packages]]
|
||||
name = "httpd"
|
||||
version = "2.4.*"`
|
||||
|
||||
req := httptest.NewRequest("POST", "/api/v0/blueprints/workspace", bytes.NewReader([]byte(blueprint)))
|
||||
req.Header.Set("Content-Type", "text/x-toml")
|
||||
recorder := httptest.NewRecorder()
|
||||
|
||||
api, _ := createWeldrAPI(rpmmd_mock.BaseFixture)
|
||||
api.ServeHTTP(recorder, req)
|
||||
|
||||
r := recorder.Result()
|
||||
if r.StatusCode != http.StatusOK {
|
||||
t.Fatalf("unexpected status %v", r.StatusCode)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBlueprintsInfo(t *testing.T) {
|
||||
var cases = []struct {
|
||||
Method string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue