Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
88
pkg/common/hmi_tx_test.go
Normal file
88
pkg/common/hmi_tx_test.go
Normal file
@@ -0,0 +1,88 @@
|
||||
package common_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"fiskerinc.com/modules/common"
|
||||
"fiskerinc.com/modules/common/dbbasemodel"
|
||||
"fiskerinc.com/modules/testhelper"
|
||||
)
|
||||
|
||||
func TestHMITXMessages(t *testing.T) {
|
||||
schema := "file://" + testhelper.GetSchemaDirPath() + "/hmi/TXMessage.json"
|
||||
now := time.Now()
|
||||
|
||||
tests := []testhelper.SchemaTest{
|
||||
{
|
||||
Name: "TestHMIVerifySalt",
|
||||
Object: common.Message{
|
||||
Handler: "verify",
|
||||
Data: common.HMISessionData{
|
||||
Salt: "testsalt",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "TestHMIVerifySession",
|
||||
Object: common.Message{
|
||||
Handler: "verify",
|
||||
Data: common.HMISessionData{
|
||||
SessionID: "test_session_id",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "TestHMIProfiles",
|
||||
Object: common.Message{
|
||||
Handler: "profiles",
|
||||
Data: nil,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "TestHMISettingsUpdate",
|
||||
Object: common.Message{
|
||||
Handler: "settings_update",
|
||||
Data: common.HMISettingsUpdate{
|
||||
DriverID: "valid-cognito-id-1",
|
||||
Settings: []common.CarSetting{{
|
||||
Name: "TESTSETTING",
|
||||
Value: "TESTVALUE",
|
||||
Type: "string",
|
||||
DBModelBase: dbbasemodel.DBModelBase{
|
||||
UpdatedAt: &now,
|
||||
},
|
||||
}},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "TestHMIPOIs",
|
||||
Object: common.Message{
|
||||
Handler: "user_pois",
|
||||
Data: common.HMIPOIsMessage{
|
||||
DriverID: "valid-cognito-id-1",
|
||||
UserPOIs: []common.PointOfInterest{
|
||||
{
|
||||
Name: "TestWorkPOI",
|
||||
Location: common.POILocation{
|
||||
Latitude: 1.11,
|
||||
Longitude: 2.22,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "TestHomePOI",
|
||||
Location: common.POILocation{
|
||||
Latitude: 8.88,
|
||||
Longitude: 9.99,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
testhelper.NewSchemaTestHelper(t, schema).
|
||||
RunSchemaTests(tests)
|
||||
}
|
||||
Reference in New Issue
Block a user