Update shared visibility tests
This commit is contained in:
parent
91114d35c3
commit
98282ba4b5
2 changed files with 31 additions and 6 deletions
5
rpc.go
5
rpc.go
|
|
@ -30,11 +30,6 @@ func (r *rpcClient) do(ctx context.Context, method string, args interface{}, res
|
|||
return fmt.Errorf("error on dispatch call: %v", err)
|
||||
}
|
||||
|
||||
// caller doesn't care about result, so lets ignore it
|
||||
if result == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return waiter.Wait(ctx, result)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -182,5 +182,35 @@ func TestServerGetSharedServers(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServerUpdateSharedVisibility(t *testing.T) {
|
||||
|
||||
updateSharedVisibility := func(req *jsonrpc2.Request) error {
|
||||
return nil
|
||||
}
|
||||
testServer, client, err := newMockJoinedClient(
|
||||
livesharetest.WithService("serverSharing.updateSharedServerVisibility", updateSharedVisibility),
|
||||
)
|
||||
if err != nil {
|
||||
t.Errorf("creating new mock client: %v", err)
|
||||
}
|
||||
defer testServer.Close()
|
||||
server, err := NewServer(client)
|
||||
if err != nil {
|
||||
t.Errorf("creating server: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
done := make(chan error)
|
||||
go func() {
|
||||
if err := server.UpdateSharedVisibility(ctx, 80, true); err != nil {
|
||||
done <- err
|
||||
return
|
||||
}
|
||||
done <- nil
|
||||
}()
|
||||
select {
|
||||
case err := <-testServer.Err():
|
||||
t.Errorf("error from server: %v", err)
|
||||
case err := <-done:
|
||||
if err != nil {
|
||||
t.Errorf("error from client: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue