mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
WIP: scenario test independent of test data
This commit is contained in:
parent
44c1a0f2eb
commit
3c4624d17e
2 changed files with 2 additions and 13 deletions
|
@ -25,7 +25,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rwth-aachen.de/acs/public/villas/web-backend-go/database"
|
"git.rwth-aachen.de/acs/public/villas/web-backend-go/database"
|
||||||
"github.com/jinzhu/gorm/dialects/postgres"
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
|
@ -85,16 +84,6 @@ type UserRequest struct {
|
||||||
Active string `json:"active,omitempty"`
|
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 {
|
func ReadTestDataFromJson(path string) error {
|
||||||
|
|
||||||
jsonFile, err := os.Open(path)
|
jsonFile, err := os.Open(path)
|
||||||
|
|
|
@ -212,8 +212,8 @@ func TestUpdateScenario(t *testing.T) {
|
||||||
|
|
||||||
updatedScenario := ScenarioRequest{
|
updatedScenario := ScenarioRequest{
|
||||||
Name: "Updated name",
|
Name: "Updated name",
|
||||||
Running: !helper.ScenarioA.Running,
|
Running: false,
|
||||||
StartParameters: helper.ScenarioA.StartParameters,
|
StartParameters: postgres.Jsonb{RawMessage: json.RawMessage(`{"parameter1" : "testValue1A", "parameter2" : "testValue2A", "parameter3" : 42}`)},
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to update with non JSON body
|
// try to update with non JSON body
|
||||||
|
|
Loading…
Add table
Reference in a new issue