Skip to content

Commit

Permalink
Remove UserGet call in tests since it's note required for anon sessions
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
  • Loading branch information
marcosnils committed Oct 3, 2020
1 parent 58a3432 commit 7fadf5b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 8 deletions.
3 changes: 0 additions & 3 deletions pwd/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func TestClientNew(t *testing.T) {
_d.On("DaemonHost").Return("localhost")
_d.On("NetworkConnect", config.L2ContainerName, "aaaabbbbcccc", "").Return("10.0.0.1", nil)
_s.On("SessionPut", mock.AnythingOfType("*types.Session")).Return(nil)
_s.On("UserGet", mock.Anything).Return(&types.User{}, nil)
_s.On("SessionCount").Return(1, nil)
_s.On("InstanceCount").Return(0, nil)
_s.On("ClientCount").Return(1, nil)
Expand Down Expand Up @@ -77,7 +76,6 @@ func TestClientCount(t *testing.T) {
_d.On("DaemonHost").Return("localhost")
_d.On("NetworkConnect", config.L2ContainerName, "aaaabbbbcccc", "").Return("10.0.0.1", nil)
_s.On("SessionPut", mock.AnythingOfType("*types.Session")).Return(nil)
_s.On("UserGet", mock.Anything).Return(&types.User{}, nil)
_s.On("ClientPut", mock.AnythingOfType("*types.Client")).Return(nil)
_s.On("ClientCount").Return(1, nil)
_s.On("SessionCount").Return(1, nil)
Expand Down Expand Up @@ -120,7 +118,6 @@ func TestClientResizeViewPort(t *testing.T) {
_d.On("NetworkConnect", config.L2ContainerName, "aaaabbbbcccc", "").Return("10.0.0.1", nil)
_s.On("SessionPut", mock.AnythingOfType("*types.Session")).Return(nil)
_s.On("SessionCount").Return(1, nil)
_s.On("UserGet", mock.Anything).Return(&types.User{}, nil)
_s.On("InstanceCount").Return(0, nil)
_s.On("InstanceFindBySessionId", "aaaabbbbcccc").Return([]*types.Instance{}, nil)
_s.On("ClientPut", mock.AnythingOfType("*types.Client")).Return(nil)
Expand Down
3 changes: 0 additions & 3 deletions pwd/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func TestInstanceNew(t *testing.T) {
_d.On("NetworkConnect", config.L2ContainerName, "aaaabbbbcccc", "").Return("10.0.0.1", nil)
_s.On("SessionPut", mock.AnythingOfType("*types.Session")).Return(nil)
_s.On("SessionCount").Return(1, nil)
_s.On("UserGet", mock.Anything).Return(&types.User{}, nil)
_s.On("ClientCount").Return(0, nil)
_s.On("InstanceCount").Return(0, nil)
_s.On("InstanceFindBySessionId", "aaaabbbbcccc").Return([]*types.Instance{}, nil)
Expand Down Expand Up @@ -135,7 +134,6 @@ func TestInstanceNew_WithNotAllowedImage(t *testing.T) {
_d.On("NetworkConnect", config.L2ContainerName, "aaaabbbbcccc", "").Return("10.0.0.1", nil)
_s.On("SessionPut", mock.AnythingOfType("*types.Session")).Return(nil)
_s.On("SessionCount").Return(1, nil)
_s.On("UserGet", mock.Anything).Return(&types.User{}, nil)
_s.On("ClientCount").Return(0, nil)
_s.On("InstanceCount").Return(0, nil)
_s.On("InstanceFindBySessionId", "aaaabbbbcccc").Return([]*types.Instance{}, nil)
Expand Down Expand Up @@ -216,7 +214,6 @@ func TestInstanceNew_WithCustomHostname(t *testing.T) {
_d.On("DaemonHost").Return("localhost")
_d.On("NetworkConnect", config.L2ContainerName, "aaaabbbbcccc", "").Return("10.0.0.1", nil)
_s.On("SessionPut", mock.AnythingOfType("*types.Session")).Return(nil)
_s.On("UserGet", mock.Anything).Return(&types.User{}, nil)
_s.On("SessionCount").Return(1, nil)
_s.On("ClientCount").Return(0, nil)
_s.On("InstanceCount").Return(0, nil)
Expand Down
1 change: 0 additions & 1 deletion pwd/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func (p *pwd) SessionNew(ctx context.Context, config types.SessionConfig) (*type
// Annonymous users should be also allowed to login
if config.UserId != "" {
if _, err := p.UserGet(config.UserId); errors.Is(err, userBannedError) {

return nil, &AccessDeniedError{err}
} else if err != nil {
return nil, err
Expand Down
1 change: 0 additions & 1 deletion pwd/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func TestSessionNew(t *testing.T) {
_d.On("DaemonHost").Return("localhost")
_d.On("NetworkConnect", config.L2ContainerName, "aaaabbbbcccc", "").Return("10.0.0.1", nil)
_s.On("SessionPut", mock.AnythingOfType("*types.Session")).Return(nil)
_s.On("UserGet", mock.Anything).Return(&types.User{}, nil)
_s.On("SessionCount").Return(1, nil)
_s.On("InstanceCount").Return(0, nil)
_s.On("ClientCount").Return(0, nil)
Expand Down

0 comments on commit 7fadf5b

Please sign in to comment.