airshipui/pkg/ctl/image_test.go
Schiefelbein, Andrew e4d36d3c54 stub out remaning CTL integrations
Change-Id: Ife8125fab22c7aefc68cd6994f740940b269b380
2020-09-29 08:54:01 -05:00

48 lines
1.2 KiB
Go

/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package ctl
import (
"testing"
"github.com/stretchr/testify/assert"
"opendev.org/airship/airshipui/pkg/configs"
)
func TestHandleUnknownBaremetalSubComponent(t *testing.T) {
request := configs.WsMessage{
Type: configs.CTL,
Component: configs.Baremetal,
SubComponent: "fake_subcomponent",
}
acp := "testdata/testairshipconfig"
kcp := "testdata/testkubeconfig"
AirshipConfigPath = &acp
KubeConfigPath = &kcp
response := HandleBaremetalRequest(request)
expected := configs.WsMessage{
Type: configs.CTL,
Component: configs.Baremetal,
SubComponent: "fake_subcomponent",
Error: "Subcomponent fake_subcomponent not found",
}
assert.Equal(t, expected, response)
}