summaryrefslogtreecommitdiffstats
path: root/test/target_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/target_test.go')
-rw-r--r--test/target_test.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/target_test.go b/test/target_test.go
index 401c641..e222505 100644
--- a/test/target_test.go
+++ b/test/target_test.go
@@ -147,6 +147,13 @@ func AddTerms(t *testing.T, nbTerms int, listID []string, chTermEvt chan xsapiv1
}
func PostTerms(t *testing.T, post string, chTermEvt chan xsapiv1.TerminalConfig) {
+ var status string
+ switch post {
+ case "open":
+ status = "Open"
+ case "close":
+ status = "Closing"
+ }
var targets []xsapiv1.TargetConfig
assert.Nil(t, HTTPCli.Get("/targets", &targets))
for i := 0; i < len(targets); i++ {
@@ -155,12 +162,14 @@ func PostTerms(t *testing.T, post string, chTermEvt chan xsapiv1.TerminalConfig)
listTermsID := make([]string, len(terms))
for j := 0; j < len(terms); j++ {
var term xsapiv1.TerminalConfig
- assert.Nil(t, HTTPCli.Post("/targets/"+targets[i].ID+"/terminals/"+terms[j].ID+"/"+post, term, &term))
+ assert.Nil(t, HTTPCli.Post("/targets/"+targets[i].ID+"/terminals/"+terms[j].ID+"/"+post, terms[j], &term))
termEvt := <-chTermEvt //waiting for event terminalStateChange
assert.Equal(t, term.ID, termEvt.ID)
- assert.True(t, strings.EqualFold(termEvt.Status, post))
+ assert.Equal(t, term.Status, status)
+ assert.Equal(t, termEvt.Status, status)
listTermsID[i] = term.ID
}
+ time.Sleep(10 * time.Millisecond)
for j := 0; j < len(listTermsID); j++ {
var term xsapiv1.TerminalConfig
assert.Nil(t, HTTPCli.Get("/targets/"+targets[i].ID+"/terminals/"+listTermsID[i], &term))