Multiple playgrounds support (#215)
* Add Playground struct and basic support for creating it and retrieving it * Add missing functions in pwd mock * Get playground from request domain and validate it exists. If valid set it on the newly created session. * Move playground specific configurations to the playground struct and use it everytime we need that conf. * Don't allow to specify a duration bigger that the allowed in the playground
This commit is contained in:
committed by
GitHub
parent
3dee0d3f0b
commit
3f5b3882dd
@@ -43,7 +43,9 @@ func TestClientNew(t *testing.T) {
|
||||
p := NewPWD(_f, _e, _s, sp, ipf)
|
||||
p.generator = _g
|
||||
|
||||
session, err := p.SessionNew("", time.Hour, "", "", "")
|
||||
playground := &types.Playground{Id: "foobar"}
|
||||
|
||||
session, err := p.SessionNew(playground, "", time.Hour, "", "", "")
|
||||
assert.Nil(t, err)
|
||||
|
||||
client := p.ClientNew("foobar", session)
|
||||
@@ -81,8 +83,9 @@ func TestClientCount(t *testing.T) {
|
||||
|
||||
p := NewPWD(_f, _e, _s, sp, ipf)
|
||||
p.generator = _g
|
||||
playground := &types.Playground{Id: "foobar"}
|
||||
|
||||
session, err := p.SessionNew("", time.Hour, "", "", "")
|
||||
session, err := p.SessionNew(playground, "", time.Hour, "", "", "")
|
||||
assert.Nil(t, err)
|
||||
|
||||
p.ClientNew("foobar", session)
|
||||
@@ -122,8 +125,9 @@ func TestClientResizeViewPort(t *testing.T) {
|
||||
_e.M.On("Emit", event.INSTANCE_VIEWPORT_RESIZE, "aaaabbbbcccc", []interface{}{uint(80), uint(24)}).Return()
|
||||
p := NewPWD(_f, _e, _s, sp, ipf)
|
||||
p.generator = _g
|
||||
playground := &types.Playground{Id: "foobar"}
|
||||
|
||||
session, err := p.SessionNew("", time.Hour, "", "", "")
|
||||
session, err := p.SessionNew(playground, "", time.Hour, "", "", "")
|
||||
assert.Nil(t, err)
|
||||
client := p.ClientNew("foobar", session)
|
||||
_s.On("ClientFindBySessionId", "aaaabbbbcccc").Return([]*types.Client{client}, nil)
|
||||
|
||||
Reference in New Issue
Block a user