mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
do not change global test data in database tests, add data in each test function and do not use populateDummyDB function in DB testing
This commit is contained in:
parent
dee277bf19
commit
36dfda1ac0
2 changed files with 302 additions and 133 deletions
|
@ -20,8 +20,6 @@ func TestMain(m *testing.M) {
|
||||||
db = DummyInitDB()
|
db = DummyInitDB()
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
DummyPopulateDB(db)
|
|
||||||
|
|
||||||
os.Exit(m.Run())
|
os.Exit(m.Run())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +32,33 @@ func TestDBConnection(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUserAssociations(t *testing.T) {
|
func TestUserAssociations(t *testing.T) {
|
||||||
|
|
||||||
|
DropTables(db)
|
||||||
|
MigrateModels(db)
|
||||||
|
|
||||||
|
// create copies of global test data
|
||||||
|
scenarioA := ScenarioA
|
||||||
|
scenarioB := ScenarioB
|
||||||
|
user0 := User0
|
||||||
|
userA := UserA
|
||||||
|
userB := UserB
|
||||||
|
|
||||||
|
// add three users to DB
|
||||||
|
assert.NoError(t, db.Create(&user0).Error) // Admin
|
||||||
|
assert.NoError(t, db.Create(&userA).Error) // Normal User
|
||||||
|
assert.NoError(t, db.Create(&userB).Error) // Normal User
|
||||||
|
|
||||||
|
// add two scenarios to DB
|
||||||
|
assert.NoError(t, db.Create(&scenarioA).Error)
|
||||||
|
assert.NoError(t, db.Create(&scenarioB).Error)
|
||||||
|
|
||||||
|
// add many-to-many associations between users and scenarios
|
||||||
|
// User HM Scenarios, Scenario HM Users (Many-to-Many)
|
||||||
|
assert.NoError(t, db.Model(&scenarioA).Association("Users").Append(&userA).Error)
|
||||||
|
assert.NoError(t, db.Model(&scenarioA).Association("Users").Append(&userB).Error)
|
||||||
|
assert.NoError(t, db.Model(&scenarioB).Association("Users").Append(&userA).Error)
|
||||||
|
assert.NoError(t, db.Model(&scenarioB).Association("Users").Append(&userB).Error)
|
||||||
|
|
||||||
var usr1 User
|
var usr1 User
|
||||||
assert.NoError(t, db.Find(&usr1, "ID = ?", 2).Error, fM("User", 2))
|
assert.NoError(t, db.Find(&usr1, "ID = ?", 2).Error, fM("User", 2))
|
||||||
assert.EqualValues(t, "User_A", usr1.Username)
|
assert.EqualValues(t, "User_A", usr1.Username)
|
||||||
|
@ -48,6 +73,53 @@ func TestUserAssociations(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestScenarioAssociations(t *testing.T) {
|
func TestScenarioAssociations(t *testing.T) {
|
||||||
|
|
||||||
|
DropTables(db)
|
||||||
|
MigrateModels(db)
|
||||||
|
|
||||||
|
// create copies of global test data
|
||||||
|
scenarioA := ScenarioA
|
||||||
|
scenarioB := ScenarioB
|
||||||
|
user0 := User0
|
||||||
|
userA := UserA
|
||||||
|
userB := UserB
|
||||||
|
modelA := SimulationModelA
|
||||||
|
modelB := SimulationModelB
|
||||||
|
dashboardA := DashboardA
|
||||||
|
dashboardB := DashboardB
|
||||||
|
|
||||||
|
// add scenarios to DB
|
||||||
|
assert.NoError(t, db.Create(&scenarioA).Error)
|
||||||
|
assert.NoError(t, db.Create(&scenarioB).Error)
|
||||||
|
|
||||||
|
// add users to DB
|
||||||
|
assert.NoError(t, db.Create(&user0).Error) // Admin
|
||||||
|
assert.NoError(t, db.Create(&userA).Error) // Normal User
|
||||||
|
assert.NoError(t, db.Create(&userB).Error) // Normal User
|
||||||
|
|
||||||
|
// add simulation models to DB
|
||||||
|
assert.NoError(t, db.Create(&modelA).Error)
|
||||||
|
assert.NoError(t, db.Create(&modelB).Error)
|
||||||
|
|
||||||
|
// add dashboards to DB
|
||||||
|
assert.NoError(t, db.Create(&dashboardA).Error)
|
||||||
|
assert.NoError(t, db.Create(&dashboardB).Error)
|
||||||
|
|
||||||
|
// add many-to-many associations between users and scenarios
|
||||||
|
// User HM Scenarios, Scenario HM Users (Many-to-Many)
|
||||||
|
assert.NoError(t, db.Model(&scenarioA).Association("Users").Append(&userA).Error)
|
||||||
|
assert.NoError(t, db.Model(&scenarioA).Association("Users").Append(&userB).Error)
|
||||||
|
assert.NoError(t, db.Model(&scenarioB).Association("Users").Append(&userA).Error)
|
||||||
|
assert.NoError(t, db.Model(&scenarioB).Association("Users").Append(&userB).Error)
|
||||||
|
|
||||||
|
// add scenario has many simulation models associations
|
||||||
|
assert.NoError(t, db.Model(&scenarioA).Association("SimulationModels").Append(&modelA).Error)
|
||||||
|
assert.NoError(t, db.Model(&scenarioA).Association("SimulationModels").Append(&modelB).Error)
|
||||||
|
|
||||||
|
// Scenario HM Dashboards
|
||||||
|
assert.NoError(t, db.Model(&scenarioA).Association("Dashboards").Append(&dashboardA).Error)
|
||||||
|
assert.NoError(t, db.Model(&scenarioA).Association("Dashboards").Append(&dashboardB).Error)
|
||||||
|
|
||||||
var scenario1 Scenario
|
var scenario1 Scenario
|
||||||
assert.NoError(t, db.Find(&scenario1, 1).Error, fM("Scenario", 1))
|
assert.NoError(t, db.Find(&scenario1, 1).Error, fM("Scenario", 1))
|
||||||
assert.EqualValues(t, "Scenario_A", scenario1.Name)
|
assert.EqualValues(t, "Scenario_A", scenario1.Name)
|
||||||
|
@ -78,6 +150,28 @@ func TestScenarioAssociations(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSimulatorAssociations(t *testing.T) {
|
func TestSimulatorAssociations(t *testing.T) {
|
||||||
|
|
||||||
|
DropTables(db)
|
||||||
|
MigrateModels(db)
|
||||||
|
|
||||||
|
// create copies of global test data
|
||||||
|
simulatorA := SimulatorA
|
||||||
|
simulatorB := SimulatorB
|
||||||
|
modelA := SimulationModelA
|
||||||
|
modelB := SimulationModelB
|
||||||
|
|
||||||
|
// add simulators to DB
|
||||||
|
assert.NoError(t, db.Create(&simulatorA).Error)
|
||||||
|
assert.NoError(t, db.Create(&simulatorB).Error)
|
||||||
|
|
||||||
|
// add simulation models to DB
|
||||||
|
assert.NoError(t, db.Create(&modelA).Error)
|
||||||
|
assert.NoError(t, db.Create(&modelB).Error)
|
||||||
|
|
||||||
|
// add simulator has many simulation models association to DB
|
||||||
|
assert.NoError(t, db.Model(&simulatorA).Association("SimulationModels").Append(&modelA).Error)
|
||||||
|
assert.NoError(t, db.Model(&simulatorA).Association("SimulationModels").Append(&modelB).Error)
|
||||||
|
|
||||||
var simulator1 Simulator
|
var simulator1 Simulator
|
||||||
assert.NoError(t, db.Find(&simulator1, 1).Error, fM("Simulator", 1))
|
assert.NoError(t, db.Find(&simulator1, 1).Error, fM("Simulator", 1))
|
||||||
assert.EqualValues(t, "Host_A", simulator1.Host)
|
assert.EqualValues(t, "Host_A", simulator1.Host)
|
||||||
|
@ -92,6 +186,58 @@ func TestSimulatorAssociations(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSimulationModelAssociations(t *testing.T) {
|
func TestSimulationModelAssociations(t *testing.T) {
|
||||||
|
|
||||||
|
DropTables(db)
|
||||||
|
MigrateModels(db)
|
||||||
|
|
||||||
|
// create copies of global test data
|
||||||
|
modelA := SimulationModelA
|
||||||
|
modelB := SimulationModelB
|
||||||
|
outSignalA := OutSignalA
|
||||||
|
outSignalB := OutSignalB
|
||||||
|
inSignalA := InSignalA
|
||||||
|
inSignalB := InSignalB
|
||||||
|
fileA := FileA
|
||||||
|
fileB := FileB
|
||||||
|
fileC := FileC
|
||||||
|
fileD := FileD
|
||||||
|
simulatorA := SimulatorA
|
||||||
|
simulatorB := SimulatorB
|
||||||
|
|
||||||
|
// add simulation models to DB
|
||||||
|
assert.NoError(t, db.Create(&modelA).Error)
|
||||||
|
assert.NoError(t, db.Create(&modelB).Error)
|
||||||
|
|
||||||
|
// add signals to DB
|
||||||
|
assert.NoError(t, db.Create(&outSignalA).Error)
|
||||||
|
assert.NoError(t, db.Create(&outSignalB).Error)
|
||||||
|
assert.NoError(t, db.Create(&inSignalA).Error)
|
||||||
|
assert.NoError(t, db.Create(&inSignalB).Error)
|
||||||
|
|
||||||
|
// add files to DB
|
||||||
|
assert.NoError(t, db.Create(&fileA).Error)
|
||||||
|
assert.NoError(t, db.Create(&fileB).Error)
|
||||||
|
assert.NoError(t, db.Create(&fileC).Error)
|
||||||
|
assert.NoError(t, db.Create(&fileD).Error)
|
||||||
|
|
||||||
|
// add simulators to DB
|
||||||
|
assert.NoError(t, db.Create(&simulatorA).Error)
|
||||||
|
assert.NoError(t, db.Create(&simulatorB).Error)
|
||||||
|
|
||||||
|
// add simulation model has many signals associations
|
||||||
|
assert.NoError(t, db.Model(&modelA).Association("InputMapping").Append(&inSignalA).Error)
|
||||||
|
assert.NoError(t, db.Model(&modelA).Association("InputMapping").Append(&inSignalB).Error)
|
||||||
|
assert.NoError(t, db.Model(&modelA).Association("OutputMapping").Append(&outSignalA).Error)
|
||||||
|
assert.NoError(t, db.Model(&modelA).Association("OutputMapping").Append(&outSignalB).Error)
|
||||||
|
|
||||||
|
// add simulation model has many files associations
|
||||||
|
assert.NoError(t, db.Model(&modelA).Association("Files").Append(&fileC).Error)
|
||||||
|
assert.NoError(t, db.Model(&modelA).Association("Files").Append(&fileD).Error)
|
||||||
|
|
||||||
|
// associate simulation models with simulators
|
||||||
|
assert.NoError(t, db.Model(&simulatorA).Association("SimulationModels").Append(&modelA).Error)
|
||||||
|
assert.NoError(t, db.Model(&simulatorA).Association("SimulationModels").Append(&modelB).Error)
|
||||||
|
|
||||||
var model1 SimulationModel
|
var model1 SimulationModel
|
||||||
assert.NoError(t, db.Find(&model1, 1).Error, fM("SimulationModel", 1))
|
assert.NoError(t, db.Find(&model1, 1).Error, fM("SimulationModel", 1))
|
||||||
assert.EqualValues(t, "SimulationModel_A", model1.Name)
|
assert.EqualValues(t, "SimulationModel_A", model1.Name)
|
||||||
|
@ -119,6 +265,28 @@ func TestSimulationModelAssociations(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDashboardAssociations(t *testing.T) {
|
func TestDashboardAssociations(t *testing.T) {
|
||||||
|
|
||||||
|
DropTables(db)
|
||||||
|
MigrateModels(db)
|
||||||
|
|
||||||
|
// create copies of global test data
|
||||||
|
dashboardA := DashboardA
|
||||||
|
dashboardB := DashboardB
|
||||||
|
widgetA := WidgetA
|
||||||
|
widgetB := WidgetB
|
||||||
|
|
||||||
|
// add dashboards to DB
|
||||||
|
assert.NoError(t, db.Create(&dashboardA).Error)
|
||||||
|
assert.NoError(t, db.Create(&dashboardB).Error)
|
||||||
|
|
||||||
|
// add widgets to DB
|
||||||
|
assert.NoError(t, db.Create(&widgetA).Error)
|
||||||
|
assert.NoError(t, db.Create(&widgetB).Error)
|
||||||
|
|
||||||
|
// add dashboard has many widgets associations to DB
|
||||||
|
assert.NoError(t, db.Model(&dashboardA).Association("Widgets").Append(&widgetA).Error)
|
||||||
|
assert.NoError(t, db.Model(&dashboardA).Association("Widgets").Append(&widgetB).Error)
|
||||||
|
|
||||||
var dashboard1 Dashboard
|
var dashboard1 Dashboard
|
||||||
assert.NoError(t, db.Find(&dashboard1, 1).Error, fM("Dashboard", 1))
|
assert.NoError(t, db.Find(&dashboard1, 1).Error, fM("Dashboard", 1))
|
||||||
assert.EqualValues(t, "Dashboard_A", dashboard1.Name)
|
assert.EqualValues(t, "Dashboard_A", dashboard1.Name)
|
||||||
|
@ -133,6 +301,32 @@ func TestDashboardAssociations(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWidgetAssociations(t *testing.T) {
|
func TestWidgetAssociations(t *testing.T) {
|
||||||
|
|
||||||
|
DropTables(db)
|
||||||
|
MigrateModels(db)
|
||||||
|
|
||||||
|
// create copies of global test data
|
||||||
|
widgetA := WidgetA
|
||||||
|
widgetB := WidgetB
|
||||||
|
fileA := FileA
|
||||||
|
fileB := FileB
|
||||||
|
fileC := FileC
|
||||||
|
fileD := FileD
|
||||||
|
|
||||||
|
// add widgets to DB
|
||||||
|
assert.NoError(t, db.Create(&widgetA).Error)
|
||||||
|
assert.NoError(t, db.Create(&widgetB).Error)
|
||||||
|
|
||||||
|
// add files to DB
|
||||||
|
assert.NoError(t, db.Create(&fileA).Error)
|
||||||
|
assert.NoError(t, db.Create(&fileB).Error)
|
||||||
|
assert.NoError(t, db.Create(&fileC).Error)
|
||||||
|
assert.NoError(t, db.Create(&fileD).Error)
|
||||||
|
|
||||||
|
// add widget has many files associations to DB
|
||||||
|
assert.NoError(t, db.Model(&widgetA).Association("Files").Append(&fileA).Error)
|
||||||
|
assert.NoError(t, db.Model(&widgetA).Association("Files").Append(&fileB).Error)
|
||||||
|
|
||||||
var widget1 Widget
|
var widget1 Widget
|
||||||
assert.NoError(t, db.Find(&widget1, 1).Error, fM("Widget", 1))
|
assert.NoError(t, db.Find(&widget1, 1).Error, fM("Widget", 1))
|
||||||
assert.EqualValues(t, "Widget_A", widget1.Name)
|
assert.EqualValues(t, "Widget_A", widget1.Name)
|
||||||
|
@ -147,6 +341,22 @@ func TestWidgetAssociations(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFileAssociations(t *testing.T) {
|
func TestFileAssociations(t *testing.T) {
|
||||||
|
|
||||||
|
DropTables(db)
|
||||||
|
MigrateModels(db)
|
||||||
|
|
||||||
|
// create copies of global test data
|
||||||
|
fileA := FileA
|
||||||
|
fileB := FileB
|
||||||
|
fileC := FileC
|
||||||
|
fileD := FileD
|
||||||
|
|
||||||
|
// add files to DB
|
||||||
|
assert.NoError(t, db.Create(&fileA).Error)
|
||||||
|
assert.NoError(t, db.Create(&fileB).Error)
|
||||||
|
assert.NoError(t, db.Create(&fileC).Error)
|
||||||
|
assert.NoError(t, db.Create(&fileD).Error)
|
||||||
|
|
||||||
var file1 File
|
var file1 File
|
||||||
assert.NoError(t, db.Find(&file1, 1).Error, fM("File", 1))
|
assert.NoError(t, db.Find(&file1, 1).Error, fM("File", 1))
|
||||||
assert.EqualValues(t, "File_A", file1.Name)
|
assert.EqualValues(t, "File_A", file1.Name)
|
||||||
|
|
|
@ -158,8 +158,6 @@ var SimulationModelA = SimulationModel{
|
||||||
Name: "SimulationModel_A",
|
Name: "SimulationModel_A",
|
||||||
OutputLength: 1,
|
OutputLength: 1,
|
||||||
InputLength: 1,
|
InputLength: 1,
|
||||||
ScenarioID: 1,
|
|
||||||
SimulatorID: 1,
|
|
||||||
StartParameters: postgres.Jsonb{startParametersA},
|
StartParameters: postgres.Jsonb{startParametersA},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,8 +166,6 @@ var SimulationModelA_response = SimulationModelResponse{
|
||||||
Name: SimulationModelA.Name,
|
Name: SimulationModelA.Name,
|
||||||
InputLength: SimulationModelA.InputLength,
|
InputLength: SimulationModelA.InputLength,
|
||||||
OutputLength: SimulationModelA.OutputLength,
|
OutputLength: SimulationModelA.OutputLength,
|
||||||
ScenarioID: SimulationModelA.ScenarioID,
|
|
||||||
SimulatorID: SimulationModelA.SimulatorID,
|
|
||||||
StartParameters: SimulationModelA.StartParameters,
|
StartParameters: SimulationModelA.StartParameters,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,8 +173,6 @@ var SimulationModelB = SimulationModel{
|
||||||
Name: "SimulationModel_B",
|
Name: "SimulationModel_B",
|
||||||
OutputLength: 1,
|
OutputLength: 1,
|
||||||
InputLength: 1,
|
InputLength: 1,
|
||||||
ScenarioID: 1,
|
|
||||||
SimulatorID: 1,
|
|
||||||
StartParameters: postgres.Jsonb{startParametersB},
|
StartParameters: postgres.Jsonb{startParametersB},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,8 +181,6 @@ var SimulationModelB_response = SimulationModelResponse{
|
||||||
Name: SimulationModelB.Name,
|
Name: SimulationModelB.Name,
|
||||||
InputLength: SimulationModelB.InputLength,
|
InputLength: SimulationModelB.InputLength,
|
||||||
OutputLength: SimulationModelB.OutputLength,
|
OutputLength: SimulationModelB.OutputLength,
|
||||||
ScenarioID: SimulationModelB.ScenarioID,
|
|
||||||
SimulatorID: SimulationModelB.SimulatorID,
|
|
||||||
StartParameters: SimulationModelB.StartParameters,
|
StartParameters: SimulationModelB.StartParameters,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,8 +188,6 @@ var SimulationModelC = SimulationModel{
|
||||||
Name: "SimulationModel_C",
|
Name: "SimulationModel_C",
|
||||||
OutputLength: 1,
|
OutputLength: 1,
|
||||||
InputLength: 1,
|
InputLength: 1,
|
||||||
ScenarioID: 1,
|
|
||||||
SimulatorID: 1,
|
|
||||||
StartParameters: postgres.Jsonb{startParametersC},
|
StartParameters: postgres.Jsonb{startParametersC},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +229,6 @@ var OutSignalA = Signal{
|
||||||
Direction: "out",
|
Direction: "out",
|
||||||
Index: 0,
|
Index: 0,
|
||||||
Unit: "V",
|
Unit: "V",
|
||||||
SimulationModelID: 1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var OutSignalA_response = SignalResponse{
|
var OutSignalA_response = SignalResponse{
|
||||||
|
@ -247,7 +236,6 @@ var OutSignalA_response = SignalResponse{
|
||||||
Direction: OutSignalA.Direction,
|
Direction: OutSignalA.Direction,
|
||||||
Index: OutSignalA.Index,
|
Index: OutSignalA.Index,
|
||||||
Unit: OutSignalA.Unit,
|
Unit: OutSignalA.Unit,
|
||||||
SimulationModelID: OutSignalA.SimulationModelID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var OutSignalB = Signal{
|
var OutSignalB = Signal{
|
||||||
|
@ -255,7 +243,6 @@ var OutSignalB = Signal{
|
||||||
Direction: "out",
|
Direction: "out",
|
||||||
Index: 1,
|
Index: 1,
|
||||||
Unit: "V",
|
Unit: "V",
|
||||||
SimulationModelID: 1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var OutSignalB_response = SignalResponse{
|
var OutSignalB_response = SignalResponse{
|
||||||
|
@ -263,7 +250,6 @@ var OutSignalB_response = SignalResponse{
|
||||||
Direction: OutSignalB.Direction,
|
Direction: OutSignalB.Direction,
|
||||||
Index: OutSignalB.Index,
|
Index: OutSignalB.Index,
|
||||||
Unit: OutSignalB.Unit,
|
Unit: OutSignalB.Unit,
|
||||||
SimulationModelID: OutSignalB.SimulationModelID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var InSignalA = Signal{
|
var InSignalA = Signal{
|
||||||
|
@ -271,7 +257,6 @@ var InSignalA = Signal{
|
||||||
Direction: "in",
|
Direction: "in",
|
||||||
Index: 0,
|
Index: 0,
|
||||||
Unit: "A",
|
Unit: "A",
|
||||||
SimulationModelID: 1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var InSignalA_response = SignalResponse{
|
var InSignalA_response = SignalResponse{
|
||||||
|
@ -279,7 +264,6 @@ var InSignalA_response = SignalResponse{
|
||||||
Direction: InSignalA.Direction,
|
Direction: InSignalA.Direction,
|
||||||
Index: InSignalA.Index,
|
Index: InSignalA.Index,
|
||||||
Unit: InSignalA.Unit,
|
Unit: InSignalA.Unit,
|
||||||
SimulationModelID: InSignalA.SimulationModelID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var InSignalB = Signal{
|
var InSignalB = Signal{
|
||||||
|
@ -287,7 +271,6 @@ var InSignalB = Signal{
|
||||||
Direction: "in",
|
Direction: "in",
|
||||||
Index: 1,
|
Index: 1,
|
||||||
Unit: "A",
|
Unit: "A",
|
||||||
SimulationModelID: 1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var InSignalB_response = SignalResponse{
|
var InSignalB_response = SignalResponse{
|
||||||
|
@ -295,7 +278,6 @@ var InSignalB_response = SignalResponse{
|
||||||
Direction: InSignalB.Direction,
|
Direction: InSignalB.Direction,
|
||||||
Index: InSignalB.Index,
|
Index: InSignalB.Index,
|
||||||
Unit: InSignalB.Unit,
|
Unit: InSignalB.Unit,
|
||||||
SimulationModelID: InSignalB.SimulationModelID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var InSignalC = Signal{
|
var InSignalC = Signal{
|
||||||
|
@ -303,7 +285,6 @@ var InSignalC = Signal{
|
||||||
Direction: "in",
|
Direction: "in",
|
||||||
Index: 2,
|
Index: 2,
|
||||||
Unit: "A",
|
Unit: "A",
|
||||||
SimulationModelID: 1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var InSignalC_response = SignalResponse{
|
var InSignalC_response = SignalResponse{
|
||||||
|
@ -311,7 +292,6 @@ var InSignalC_response = SignalResponse{
|
||||||
Direction: InSignalC.Direction,
|
Direction: InSignalC.Direction,
|
||||||
Index: InSignalC.Index,
|
Index: InSignalC.Index,
|
||||||
Unit: InSignalC.Unit,
|
Unit: InSignalC.Unit,
|
||||||
SimulationModelID: InSignalC.SimulationModelID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var InSignalCUpdated = Signal{
|
var InSignalCUpdated = Signal{
|
||||||
|
@ -319,7 +299,6 @@ var InSignalCUpdated = Signal{
|
||||||
Direction: InSignalC.Direction,
|
Direction: InSignalC.Direction,
|
||||||
Index: InSignalC.Index,
|
Index: InSignalC.Index,
|
||||||
Unit: "Ohm",
|
Unit: "Ohm",
|
||||||
SimulationModelID: InSignalC.SimulationModelID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var InSignalCUpdated_response = SignalResponse{
|
var InSignalCUpdated_response = SignalResponse{
|
||||||
|
@ -327,18 +306,17 @@ var InSignalCUpdated_response = SignalResponse{
|
||||||
Direction: InSignalCUpdated.Direction,
|
Direction: InSignalCUpdated.Direction,
|
||||||
Index: InSignalCUpdated.Index,
|
Index: InSignalCUpdated.Index,
|
||||||
Unit: InSignalCUpdated.Unit,
|
Unit: InSignalCUpdated.Unit,
|
||||||
SimulationModelID: InSignalCUpdated.SimulationModelID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dashboards
|
// Dashboards
|
||||||
|
|
||||||
var DashboardA = Dashboard{Name: "Dashboard_A", Grid: 15, ScenarioID: 1}
|
var DashboardA = Dashboard{Name: "Dashboard_A", Grid: 15}
|
||||||
var DashboardA_response = DashboardResponse{ID: 1, Name: DashboardA.Name, Grid: DashboardA.Grid, ScenarioID: DashboardA.ScenarioID}
|
var DashboardA_response = DashboardResponse{ID: 1, Name: DashboardA.Name, Grid: DashboardA.Grid, ScenarioID: DashboardA.ScenarioID}
|
||||||
var DashboardB = Dashboard{Name: "Dashboard_B", Grid: 10, ScenarioID: 1}
|
var DashboardB = Dashboard{Name: "Dashboard_B", Grid: 10}
|
||||||
var DashboardB_response = DashboardResponse{ID: 2, Name: DashboardB.Name, Grid: DashboardB.Grid, ScenarioID: DashboardB.ScenarioID}
|
var DashboardB_response = DashboardResponse{ID: 2, Name: DashboardB.Name, Grid: DashboardB.Grid, ScenarioID: DashboardB.ScenarioID}
|
||||||
var DashboardC = Dashboard{Name: "Dashboard_C", Grid: 25, ScenarioID: 1}
|
var DashboardC = Dashboard{Name: "Dashboard_C", Grid: 25}
|
||||||
var DashboardC_response = DashboardResponse{ID: 3, Name: DashboardC.Name, Grid: DashboardC.Grid, ScenarioID: DashboardC.ScenarioID}
|
var DashboardC_response = DashboardResponse{ID: 3, Name: DashboardC.Name, Grid: DashboardC.Grid, ScenarioID: DashboardC.ScenarioID}
|
||||||
var DashboardCUpdated = Dashboard{Name: "Dashboard_Cupdated", Grid: 24, ScenarioID: DashboardC.ScenarioID}
|
var DashboardCUpdated = Dashboard{Name: "Dashboard_Cupdated", Grid: 24}
|
||||||
var DashboardCUpdated_response = DashboardResponse{ID: 3, Name: DashboardCUpdated.Name, Grid: DashboardCUpdated.Grid, ScenarioID: DashboardCUpdated.ScenarioID}
|
var DashboardCUpdated_response = DashboardResponse{ID: 3, Name: DashboardCUpdated.Name, Grid: DashboardCUpdated.Grid, ScenarioID: DashboardCUpdated.ScenarioID}
|
||||||
|
|
||||||
// Files
|
// Files
|
||||||
|
@ -350,8 +328,6 @@ var FileA = File{
|
||||||
ImageHeight: 333,
|
ImageHeight: 333,
|
||||||
ImageWidth: 111,
|
ImageWidth: 111,
|
||||||
Date: time.Now().String(),
|
Date: time.Now().String(),
|
||||||
WidgetID: 1,
|
|
||||||
SimulationModelID: 0,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var FileA_response = FileResponse{
|
var FileA_response = FileResponse{
|
||||||
|
@ -362,8 +338,6 @@ var FileA_response = FileResponse{
|
||||||
ImageWidth: FileA.ImageWidth,
|
ImageWidth: FileA.ImageWidth,
|
||||||
ImageHeight: FileA.ImageHeight,
|
ImageHeight: FileA.ImageHeight,
|
||||||
Date: FileA.Date,
|
Date: FileA.Date,
|
||||||
WidgetID: FileA.WidgetID,
|
|
||||||
SimulationModelID: FileA.SimulationModelID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var FileB = File{
|
var FileB = File{
|
||||||
|
@ -373,8 +347,6 @@ var FileB = File{
|
||||||
ImageHeight: 55,
|
ImageHeight: 55,
|
||||||
ImageWidth: 22,
|
ImageWidth: 22,
|
||||||
Date: time.Now().String(),
|
Date: time.Now().String(),
|
||||||
WidgetID: 1,
|
|
||||||
SimulationModelID: 0,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var FileB_response = FileResponse{
|
var FileB_response = FileResponse{
|
||||||
|
@ -385,8 +357,6 @@ var FileB_response = FileResponse{
|
||||||
ImageWidth: FileB.ImageWidth,
|
ImageWidth: FileB.ImageWidth,
|
||||||
ImageHeight: FileB.ImageHeight,
|
ImageHeight: FileB.ImageHeight,
|
||||||
Date: FileB.Date,
|
Date: FileB.Date,
|
||||||
WidgetID: FileB.WidgetID,
|
|
||||||
SimulationModelID: FileB.SimulationModelID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var FileC = File{
|
var FileC = File{
|
||||||
|
@ -396,8 +366,6 @@ var FileC = File{
|
||||||
ImageHeight: 10,
|
ImageHeight: 10,
|
||||||
ImageWidth: 10,
|
ImageWidth: 10,
|
||||||
Date: time.Now().String(),
|
Date: time.Now().String(),
|
||||||
WidgetID: 0,
|
|
||||||
SimulationModelID: 1,
|
|
||||||
}
|
}
|
||||||
var FileD = File{
|
var FileD = File{
|
||||||
Name: "File_D",
|
Name: "File_D",
|
||||||
|
@ -406,8 +374,6 @@ var FileD = File{
|
||||||
ImageHeight: 400,
|
ImageHeight: 400,
|
||||||
ImageWidth: 800,
|
ImageWidth: 800,
|
||||||
Date: time.Now().String(),
|
Date: time.Now().String(),
|
||||||
WidgetID: 0,
|
|
||||||
SimulationModelID: 1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widgets
|
// Widgets
|
||||||
|
@ -427,7 +393,6 @@ var WidgetA = Widget{
|
||||||
Z: 10,
|
Z: 10,
|
||||||
IsLocked: false,
|
IsLocked: false,
|
||||||
CustomProperties: postgres.Jsonb{customPropertiesA},
|
CustomProperties: postgres.Jsonb{customPropertiesA},
|
||||||
DashboardID: 1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var WidgetA_response = WidgetResponse{
|
var WidgetA_response = WidgetResponse{
|
||||||
|
@ -443,7 +408,6 @@ var WidgetA_response = WidgetResponse{
|
||||||
Z: WidgetA.Z,
|
Z: WidgetA.Z,
|
||||||
IsLocked: WidgetA.IsLocked,
|
IsLocked: WidgetA.IsLocked,
|
||||||
CustomProperties: WidgetA.CustomProperties,
|
CustomProperties: WidgetA.CustomProperties,
|
||||||
DashboardID: WidgetA.DashboardID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var WidgetB = Widget{
|
var WidgetB = Widget{
|
||||||
|
@ -458,7 +422,6 @@ var WidgetB = Widget{
|
||||||
Z: 0,
|
Z: 0,
|
||||||
IsLocked: false,
|
IsLocked: false,
|
||||||
CustomProperties: postgres.Jsonb{customPropertiesB},
|
CustomProperties: postgres.Jsonb{customPropertiesB},
|
||||||
DashboardID: 1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var WidgetB_response = WidgetResponse{
|
var WidgetB_response = WidgetResponse{
|
||||||
|
@ -474,7 +437,6 @@ var WidgetB_response = WidgetResponse{
|
||||||
Z: WidgetB.Z,
|
Z: WidgetB.Z,
|
||||||
IsLocked: WidgetB.IsLocked,
|
IsLocked: WidgetB.IsLocked,
|
||||||
CustomProperties: WidgetB.CustomProperties,
|
CustomProperties: WidgetB.CustomProperties,
|
||||||
DashboardID: WidgetB.DashboardID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var WidgetC = Widget{
|
var WidgetC = Widget{
|
||||||
|
@ -489,7 +451,6 @@ var WidgetC = Widget{
|
||||||
Z: 13,
|
Z: 13,
|
||||||
IsLocked: false,
|
IsLocked: false,
|
||||||
CustomProperties: postgres.Jsonb{customPropertiesC},
|
CustomProperties: postgres.Jsonb{customPropertiesC},
|
||||||
DashboardID: 1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var WidgetC_response = WidgetResponse{
|
var WidgetC_response = WidgetResponse{
|
||||||
|
@ -505,7 +466,6 @@ var WidgetC_response = WidgetResponse{
|
||||||
Z: WidgetC.Z,
|
Z: WidgetC.Z,
|
||||||
IsLocked: WidgetC.IsLocked,
|
IsLocked: WidgetC.IsLocked,
|
||||||
CustomProperties: WidgetC.CustomProperties,
|
CustomProperties: WidgetC.CustomProperties,
|
||||||
DashboardID: WidgetC.DashboardID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var WidgetCUpdated_response = WidgetResponse{
|
var WidgetCUpdated_response = WidgetResponse{
|
||||||
|
@ -521,5 +481,4 @@ var WidgetCUpdated_response = WidgetResponse{
|
||||||
Z: WidgetC.Z,
|
Z: WidgetC.Z,
|
||||||
IsLocked: WidgetC.IsLocked,
|
IsLocked: WidgetC.IsLocked,
|
||||||
CustomProperties: WidgetC.CustomProperties,
|
CustomProperties: WidgetC.CustomProperties,
|
||||||
DashboardID: WidgetC.DashboardID,
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue