
These are UI changes 1. Added a constructor for websocket message 2. Fixed the airshipui-ui to be airshipui 3. Fixed the refresh not displaying a page 4. Renamed the angular components to match the go backend 5. Change the websocket service from multicast to direct messaging 6. Collapsed the notification service into the websocket service Change-Id: If8cd5d7006934b9eb59e1ea702d5158c93bfacfe
65 lines
1.7 KiB
Go
65 lines
1.7 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"
|
|
"opendev.org/airship/airshipui/util/utiltest"
|
|
)
|
|
|
|
func TestHandleDefaultBaremetalRequest(t *testing.T) {
|
|
utiltest.InitConfig(t)
|
|
|
|
request := configs.WsMessage{
|
|
Type: configs.CTL,
|
|
Component: configs.Baremetal,
|
|
SubComponent: configs.GetDefaults,
|
|
}
|
|
|
|
response := HandleBaremetalRequest(request)
|
|
|
|
expected := configs.WsMessage{
|
|
Type: configs.CTL,
|
|
Component: configs.Baremetal,
|
|
SubComponent: configs.GetDefaults,
|
|
}
|
|
|
|
assert.Equal(t, expected.Type, response.Type)
|
|
assert.Equal(t, expected.Component, response.Component)
|
|
assert.Equal(t, expected.SubComponent, response.SubComponent)
|
|
}
|
|
|
|
func TestHandleUnknownBaremetalSubComponent(t *testing.T) {
|
|
request := configs.WsMessage{
|
|
Type: configs.CTL,
|
|
Component: configs.Baremetal,
|
|
SubComponent: "fake_subcomponent",
|
|
}
|
|
|
|
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)
|
|
}
|