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()
|
||||
defer db.Close()
|
||||
|
||||
DummyPopulateDB(db)
|
||||
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
|
@ -34,6 +32,33 @@ func TestDBConnection(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
|
||||
assert.NoError(t, db.Find(&usr1, "ID = ?", 2).Error, fM("User", 2))
|
||||
assert.EqualValues(t, "User_A", usr1.Username)
|
||||
|
@ -48,6 +73,53 @@ func TestUserAssociations(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
|
||||
assert.NoError(t, db.Find(&scenario1, 1).Error, fM("Scenario", 1))
|
||||
assert.EqualValues(t, "Scenario_A", scenario1.Name)
|
||||
|
@ -78,6 +150,28 @@ func TestScenarioAssociations(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
|
||||
assert.NoError(t, db.Find(&simulator1, 1).Error, fM("Simulator", 1))
|
||||
assert.EqualValues(t, "Host_A", simulator1.Host)
|
||||
|
@ -92,6 +186,58 @@ func TestSimulatorAssociations(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
|
||||
assert.NoError(t, db.Find(&model1, 1).Error, fM("SimulationModel", 1))
|
||||
assert.EqualValues(t, "SimulationModel_A", model1.Name)
|
||||
|
@ -119,6 +265,28 @@ func TestSimulationModelAssociations(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
|
||||
assert.NoError(t, db.Find(&dashboard1, 1).Error, fM("Dashboard", 1))
|
||||
assert.EqualValues(t, "Dashboard_A", dashboard1.Name)
|
||||
|
@ -133,6 +301,32 @@ func TestDashboardAssociations(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
|
||||
assert.NoError(t, db.Find(&widget1, 1).Error, fM("Widget", 1))
|
||||
assert.EqualValues(t, "Widget_A", widget1.Name)
|
||||
|
@ -147,6 +341,22 @@ func TestWidgetAssociations(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
|
||||
assert.NoError(t, db.Find(&file1, 1).Error, fM("File", 1))
|
||||
assert.EqualValues(t, "File_A", file1.Name)
|
||||
|
|
|
@ -158,8 +158,6 @@ var SimulationModelA = SimulationModel{
|
|||
Name: "SimulationModel_A",
|
||||
OutputLength: 1,
|
||||
InputLength: 1,
|
||||
ScenarioID: 1,
|
||||
SimulatorID: 1,
|
||||
StartParameters: postgres.Jsonb{startParametersA},
|
||||
}
|
||||
|
||||
|
@ -168,8 +166,6 @@ var SimulationModelA_response = SimulationModelResponse{
|
|||
Name: SimulationModelA.Name,
|
||||
InputLength: SimulationModelA.InputLength,
|
||||
OutputLength: SimulationModelA.OutputLength,
|
||||
ScenarioID: SimulationModelA.ScenarioID,
|
||||
SimulatorID: SimulationModelA.SimulatorID,
|
||||
StartParameters: SimulationModelA.StartParameters,
|
||||
}
|
||||
|
||||
|
@ -177,8 +173,6 @@ var SimulationModelB = SimulationModel{
|
|||
Name: "SimulationModel_B",
|
||||
OutputLength: 1,
|
||||
InputLength: 1,
|
||||
ScenarioID: 1,
|
||||
SimulatorID: 1,
|
||||
StartParameters: postgres.Jsonb{startParametersB},
|
||||
}
|
||||
|
||||
|
@ -187,8 +181,6 @@ var SimulationModelB_response = SimulationModelResponse{
|
|||
Name: SimulationModelB.Name,
|
||||
InputLength: SimulationModelB.InputLength,
|
||||
OutputLength: SimulationModelB.OutputLength,
|
||||
ScenarioID: SimulationModelB.ScenarioID,
|
||||
SimulatorID: SimulationModelB.SimulatorID,
|
||||
StartParameters: SimulationModelB.StartParameters,
|
||||
}
|
||||
|
||||
|
@ -196,8 +188,6 @@ var SimulationModelC = SimulationModel{
|
|||
Name: "SimulationModel_C",
|
||||
OutputLength: 1,
|
||||
InputLength: 1,
|
||||
ScenarioID: 1,
|
||||
SimulatorID: 1,
|
||||
StartParameters: postgres.Jsonb{startParametersC},
|
||||
}
|
||||
|
||||
|
@ -235,179 +225,155 @@ var SimulationModelCUpdated_response = SimulationModelResponse{
|
|||
// Signals
|
||||
|
||||
var OutSignalA = Signal{
|
||||
Name: "outSignal_A",
|
||||
Direction: "out",
|
||||
Index: 0,
|
||||
Unit: "V",
|
||||
SimulationModelID: 1,
|
||||
Name: "outSignal_A",
|
||||
Direction: "out",
|
||||
Index: 0,
|
||||
Unit: "V",
|
||||
}
|
||||
|
||||
var OutSignalA_response = SignalResponse{
|
||||
Name: OutSignalA.Name,
|
||||
Direction: OutSignalA.Direction,
|
||||
Index: OutSignalA.Index,
|
||||
Unit: OutSignalA.Unit,
|
||||
SimulationModelID: OutSignalA.SimulationModelID,
|
||||
Name: OutSignalA.Name,
|
||||
Direction: OutSignalA.Direction,
|
||||
Index: OutSignalA.Index,
|
||||
Unit: OutSignalA.Unit,
|
||||
}
|
||||
|
||||
var OutSignalB = Signal{
|
||||
Name: "outSignal_B",
|
||||
Direction: "out",
|
||||
Index: 1,
|
||||
Unit: "V",
|
||||
SimulationModelID: 1,
|
||||
Name: "outSignal_B",
|
||||
Direction: "out",
|
||||
Index: 1,
|
||||
Unit: "V",
|
||||
}
|
||||
|
||||
var OutSignalB_response = SignalResponse{
|
||||
Name: OutSignalB.Name,
|
||||
Direction: OutSignalB.Direction,
|
||||
Index: OutSignalB.Index,
|
||||
Unit: OutSignalB.Unit,
|
||||
SimulationModelID: OutSignalB.SimulationModelID,
|
||||
Name: OutSignalB.Name,
|
||||
Direction: OutSignalB.Direction,
|
||||
Index: OutSignalB.Index,
|
||||
Unit: OutSignalB.Unit,
|
||||
}
|
||||
|
||||
var InSignalA = Signal{
|
||||
Name: "inSignal_A",
|
||||
Direction: "in",
|
||||
Index: 0,
|
||||
Unit: "A",
|
||||
SimulationModelID: 1,
|
||||
Name: "inSignal_A",
|
||||
Direction: "in",
|
||||
Index: 0,
|
||||
Unit: "A",
|
||||
}
|
||||
|
||||
var InSignalA_response = SignalResponse{
|
||||
Name: InSignalA.Name,
|
||||
Direction: InSignalA.Direction,
|
||||
Index: InSignalA.Index,
|
||||
Unit: InSignalA.Unit,
|
||||
SimulationModelID: InSignalA.SimulationModelID,
|
||||
Name: InSignalA.Name,
|
||||
Direction: InSignalA.Direction,
|
||||
Index: InSignalA.Index,
|
||||
Unit: InSignalA.Unit,
|
||||
}
|
||||
|
||||
var InSignalB = Signal{
|
||||
Name: "inSignal_B",
|
||||
Direction: "in",
|
||||
Index: 1,
|
||||
Unit: "A",
|
||||
SimulationModelID: 1,
|
||||
Name: "inSignal_B",
|
||||
Direction: "in",
|
||||
Index: 1,
|
||||
Unit: "A",
|
||||
}
|
||||
|
||||
var InSignalB_response = SignalResponse{
|
||||
Name: InSignalB.Name,
|
||||
Direction: InSignalB.Direction,
|
||||
Index: InSignalB.Index,
|
||||
Unit: InSignalB.Unit,
|
||||
SimulationModelID: InSignalB.SimulationModelID,
|
||||
Name: InSignalB.Name,
|
||||
Direction: InSignalB.Direction,
|
||||
Index: InSignalB.Index,
|
||||
Unit: InSignalB.Unit,
|
||||
}
|
||||
|
||||
var InSignalC = Signal{
|
||||
Name: "inSignal_C",
|
||||
Direction: "in",
|
||||
Index: 2,
|
||||
Unit: "A",
|
||||
SimulationModelID: 1,
|
||||
Name: "inSignal_C",
|
||||
Direction: "in",
|
||||
Index: 2,
|
||||
Unit: "A",
|
||||
}
|
||||
|
||||
var InSignalC_response = SignalResponse{
|
||||
Name: InSignalC.Name,
|
||||
Direction: InSignalC.Direction,
|
||||
Index: InSignalC.Index,
|
||||
Unit: InSignalC.Unit,
|
||||
SimulationModelID: InSignalC.SimulationModelID,
|
||||
Name: InSignalC.Name,
|
||||
Direction: InSignalC.Direction,
|
||||
Index: InSignalC.Index,
|
||||
Unit: InSignalC.Unit,
|
||||
}
|
||||
|
||||
var InSignalCUpdated = Signal{
|
||||
Name: "inSignalupdated_C",
|
||||
Direction: InSignalC.Direction,
|
||||
Index: InSignalC.Index,
|
||||
Unit: "Ohm",
|
||||
SimulationModelID: InSignalC.SimulationModelID,
|
||||
Name: "inSignalupdated_C",
|
||||
Direction: InSignalC.Direction,
|
||||
Index: InSignalC.Index,
|
||||
Unit: "Ohm",
|
||||
}
|
||||
|
||||
var InSignalCUpdated_response = SignalResponse{
|
||||
Name: InSignalCUpdated.Name,
|
||||
Direction: InSignalCUpdated.Direction,
|
||||
Index: InSignalCUpdated.Index,
|
||||
Unit: InSignalCUpdated.Unit,
|
||||
SimulationModelID: InSignalCUpdated.SimulationModelID,
|
||||
Name: InSignalCUpdated.Name,
|
||||
Direction: InSignalCUpdated.Direction,
|
||||
Index: InSignalCUpdated.Index,
|
||||
Unit: InSignalCUpdated.Unit,
|
||||
}
|
||||
|
||||
// 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 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 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 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}
|
||||
|
||||
// Files
|
||||
|
||||
var FileA = File{
|
||||
Name: "File_A",
|
||||
Type: "text/plain",
|
||||
Size: 42,
|
||||
ImageHeight: 333,
|
||||
ImageWidth: 111,
|
||||
Date: time.Now().String(),
|
||||
WidgetID: 1,
|
||||
SimulationModelID: 0,
|
||||
Name: "File_A",
|
||||
Type: "text/plain",
|
||||
Size: 42,
|
||||
ImageHeight: 333,
|
||||
ImageWidth: 111,
|
||||
Date: time.Now().String(),
|
||||
}
|
||||
|
||||
var FileA_response = FileResponse{
|
||||
ID: 1,
|
||||
Name: FileA.Name,
|
||||
Type: FileA.Type,
|
||||
Size: FileA.Size,
|
||||
ImageWidth: FileA.ImageWidth,
|
||||
ImageHeight: FileA.ImageHeight,
|
||||
Date: FileA.Date,
|
||||
WidgetID: FileA.WidgetID,
|
||||
SimulationModelID: FileA.SimulationModelID,
|
||||
ID: 1,
|
||||
Name: FileA.Name,
|
||||
Type: FileA.Type,
|
||||
Size: FileA.Size,
|
||||
ImageWidth: FileA.ImageWidth,
|
||||
ImageHeight: FileA.ImageHeight,
|
||||
Date: FileA.Date,
|
||||
}
|
||||
|
||||
var FileB = File{
|
||||
Name: "File_B",
|
||||
Type: "text/plain",
|
||||
Size: 1234,
|
||||
ImageHeight: 55,
|
||||
ImageWidth: 22,
|
||||
Date: time.Now().String(),
|
||||
WidgetID: 1,
|
||||
SimulationModelID: 0,
|
||||
Name: "File_B",
|
||||
Type: "text/plain",
|
||||
Size: 1234,
|
||||
ImageHeight: 55,
|
||||
ImageWidth: 22,
|
||||
Date: time.Now().String(),
|
||||
}
|
||||
|
||||
var FileB_response = FileResponse{
|
||||
ID: 2,
|
||||
Name: FileB.Name,
|
||||
Type: FileB.Type,
|
||||
Size: FileB.Size,
|
||||
ImageWidth: FileB.ImageWidth,
|
||||
ImageHeight: FileB.ImageHeight,
|
||||
Date: FileB.Date,
|
||||
WidgetID: FileB.WidgetID,
|
||||
SimulationModelID: FileB.SimulationModelID,
|
||||
ID: 2,
|
||||
Name: FileB.Name,
|
||||
Type: FileB.Type,
|
||||
Size: FileB.Size,
|
||||
ImageWidth: FileB.ImageWidth,
|
||||
ImageHeight: FileB.ImageHeight,
|
||||
Date: FileB.Date,
|
||||
}
|
||||
|
||||
var FileC = File{
|
||||
Name: "File_C",
|
||||
Type: "text/plain",
|
||||
Size: 32,
|
||||
ImageHeight: 10,
|
||||
ImageWidth: 10,
|
||||
Date: time.Now().String(),
|
||||
WidgetID: 0,
|
||||
SimulationModelID: 1,
|
||||
Name: "File_C",
|
||||
Type: "text/plain",
|
||||
Size: 32,
|
||||
ImageHeight: 10,
|
||||
ImageWidth: 10,
|
||||
Date: time.Now().String(),
|
||||
}
|
||||
var FileD = File{
|
||||
Name: "File_D",
|
||||
Type: "text/plain",
|
||||
Size: 5000,
|
||||
ImageHeight: 400,
|
||||
ImageWidth: 800,
|
||||
Date: time.Now().String(),
|
||||
WidgetID: 0,
|
||||
SimulationModelID: 1,
|
||||
Name: "File_D",
|
||||
Type: "text/plain",
|
||||
Size: 5000,
|
||||
ImageHeight: 400,
|
||||
ImageWidth: 800,
|
||||
Date: time.Now().String(),
|
||||
}
|
||||
|
||||
// Widgets
|
||||
|
@ -427,7 +393,6 @@ var WidgetA = Widget{
|
|||
Z: 10,
|
||||
IsLocked: false,
|
||||
CustomProperties: postgres.Jsonb{customPropertiesA},
|
||||
DashboardID: 1,
|
||||
}
|
||||
|
||||
var WidgetA_response = WidgetResponse{
|
||||
|
@ -443,7 +408,6 @@ var WidgetA_response = WidgetResponse{
|
|||
Z: WidgetA.Z,
|
||||
IsLocked: WidgetA.IsLocked,
|
||||
CustomProperties: WidgetA.CustomProperties,
|
||||
DashboardID: WidgetA.DashboardID,
|
||||
}
|
||||
|
||||
var WidgetB = Widget{
|
||||
|
@ -458,7 +422,6 @@ var WidgetB = Widget{
|
|||
Z: 0,
|
||||
IsLocked: false,
|
||||
CustomProperties: postgres.Jsonb{customPropertiesB},
|
||||
DashboardID: 1,
|
||||
}
|
||||
|
||||
var WidgetB_response = WidgetResponse{
|
||||
|
@ -474,7 +437,6 @@ var WidgetB_response = WidgetResponse{
|
|||
Z: WidgetB.Z,
|
||||
IsLocked: WidgetB.IsLocked,
|
||||
CustomProperties: WidgetB.CustomProperties,
|
||||
DashboardID: WidgetB.DashboardID,
|
||||
}
|
||||
|
||||
var WidgetC = Widget{
|
||||
|
@ -489,7 +451,6 @@ var WidgetC = Widget{
|
|||
Z: 13,
|
||||
IsLocked: false,
|
||||
CustomProperties: postgres.Jsonb{customPropertiesC},
|
||||
DashboardID: 1,
|
||||
}
|
||||
|
||||
var WidgetC_response = WidgetResponse{
|
||||
|
@ -505,7 +466,6 @@ var WidgetC_response = WidgetResponse{
|
|||
Z: WidgetC.Z,
|
||||
IsLocked: WidgetC.IsLocked,
|
||||
CustomProperties: WidgetC.CustomProperties,
|
||||
DashboardID: WidgetC.DashboardID,
|
||||
}
|
||||
|
||||
var WidgetCUpdated_response = WidgetResponse{
|
||||
|
@ -521,5 +481,4 @@ var WidgetCUpdated_response = WidgetResponse{
|
|||
Z: WidgetC.Z,
|
||||
IsLocked: WidgetC.IsLocked,
|
||||
CustomProperties: WidgetC.CustomProperties,
|
||||
DashboardID: WidgetC.DashboardID,
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue