New session now expects a struct with everything it needs and a context (#228)

to pass along
This commit is contained in:
Jonathan Leibiusky
2017-11-28 12:14:50 -03:00
committed by Marcos Nils
parent 08f1ead2a9
commit da6a55fb5c
10 changed files with 51 additions and 23 deletions

View File

@@ -1,6 +1,7 @@
package pwd
import (
"context"
"testing"
"time"
@@ -45,7 +46,8 @@ func TestClientNew(t *testing.T) {
playground := &types.Playground{Id: "foobar"}
session, err := p.SessionNew(playground, "", time.Hour, "", "", "")
sConfig := types.SessionConfig{Playground: playground, UserId: "", Duration: time.Hour, Stack: "", StackName: "", ImageName: ""}
session, err := p.SessionNew(context.Background(), sConfig)
assert.Nil(t, err)
client := p.ClientNew("foobar", session)
@@ -85,7 +87,8 @@ func TestClientCount(t *testing.T) {
p.generator = _g
playground := &types.Playground{Id: "foobar"}
session, err := p.SessionNew(playground, "", time.Hour, "", "", "")
sConfig := types.SessionConfig{Playground: playground, UserId: "", Duration: time.Hour, Stack: "", StackName: "", ImageName: ""}
session, err := p.SessionNew(context.Background(), sConfig)
assert.Nil(t, err)
p.ClientNew("foobar", session)
@@ -127,7 +130,8 @@ func TestClientResizeViewPort(t *testing.T) {
p.generator = _g
playground := &types.Playground{Id: "foobar"}
session, err := p.SessionNew(playground, "", time.Hour, "", "", "")
sConfig := types.SessionConfig{Playground: playground, UserId: "", Duration: time.Hour, Stack: "", StackName: "", ImageName: ""}
session, err := p.SessionNew(context.Background(), sConfig)
assert.Nil(t, err)
client := p.ClientNew("foobar", session)
_s.On("ClientFindBySessionId", "aaaabbbbcccc").Return([]*types.Client{client}, nil)