cloudapi: Add a test for the subscription rhc flag

This makes sure that the new flag is accepted by the API endpoint.
This commit is contained in:
Brian C. Lane 2023-02-01 16:39:29 -08:00 committed by Sanne Raymaekers
parent b0e388d115
commit 6944d15293

View file

@ -947,6 +947,42 @@ func TestComposeCustomizations(t *testing.T) {
}`, "id")
}
func TestComposeRhcSubscription(t *testing.T) {
srv, _, _, cancel := newV2Server(t, t.TempDir(), []string{""}, false, false)
defer cancel()
test.TestRoute(t, srv.Handler("/api/image-builder-composer/v2"), false, "POST", "/api/image-builder-composer/v2/compose", fmt.Sprintf(`
{
"distribution": "%s",
"customizations": {
"subscription": {
"organization": "2040324",
"activation_key": "my-secret-key",
"server_url": "subscription.rhsm.redhat.com",
"base_url": "http://cdn.redhat.com/",
"insights": false,
"rhc": true
},
"packages": [ "pkg1", "pkg2" ]
},
"image_request":{
"architecture": "%s",
"image_type": "aws",
"repositories": [{
"baseurl": "somerepo.org",
"rhsm": false
}],
"upload_options": {
"region": "eu-central-1"
}
}
}`, test_distro.TestDistroName, test_distro.TestArch3Name), http.StatusCreated, `
{
"href": "/api/image-builder-composer/v2/compose",
"kind": "ComposeId"
}`, "id")
}
func TestImageTypes(t *testing.T) {
srv, _, _, cancel := newV2Server(t, t.TempDir(), []string{""}, false, false)
defer cancel()