WIP: scenario test independent of test data

This commit is contained in:
Sonja Happ 2021-01-27 10:41:00 +01:00
parent 44c1a0f2eb
commit 3c4624d17e
2 changed files with 2 additions and 13 deletions

View file

@ -25,7 +25,6 @@ import (
"encoding/json"
"fmt"
"git.rwth-aachen.de/acs/public/villas/web-backend-go/database"
"github.com/jinzhu/gorm/dialects/postgres"
"golang.org/x/crypto/bcrypt"
"io/ioutil"
"log"
@ -85,16 +84,6 @@ type UserRequest struct {
Active string `json:"active,omitempty"`
}
// Scenarios
var startParametersA = json.RawMessage(`{"parameter1" : "testValue1A", "parameter2" : "testValue2A", "parameter3" : 42}`)
var ScenarioA = database.Scenario{
Name: "Scenario_A",
Running: true,
StartParameters: postgres.Jsonb{startParametersA},
}
func ReadTestDataFromJson(path string) error {
jsonFile, err := os.Open(path)

View file

@ -212,8 +212,8 @@ func TestUpdateScenario(t *testing.T) {
updatedScenario := ScenarioRequest{
Name: "Updated name",
Running: !helper.ScenarioA.Running,
StartParameters: helper.ScenarioA.StartParameters,
Running: false,
StartParameters: postgres.Jsonb{RawMessage: json.RawMessage(`{"parameter1" : "testValue1A", "parameter2" : "testValue2A", "parameter3" : 42}`)},
}
// try to update with non JSON body