Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLASweb-backend-go
Commits
3c4624d1
Commit
3c4624d1
authored
Jan 27, 2021
by
Sonja Happ
Browse files
WIP: scenario test independent of test data
parent
44c1a0f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
helper/test_data.go
View file @
3c4624d1
...
...
@@ -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
)
...
...
routes/scenario/scenario_test.go
View file @
3c4624d1
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment