Skip to content

Commit 2a4dd8a

Browse files
Andrew Farriesroboquat
Andrew Farries
authored andcommitted
Add test for GetOwnerToken method
1 parent e0fa9d2 commit 2a4dd8a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

components/public-api-server/pkg/apiv1/workspace_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,25 @@ func TestWorkspaceService_GetWorkspace(t *testing.T) {
119119

120120
}
121121

122+
func TestWorkspaceService_GetOwnerToken(t *testing.T) {
123+
srv := baseserver.NewForTests(t)
124+
var connPool *FakeServerConnPool
125+
126+
v1.RegisterWorkspacesServiceServer(srv.GRPC(), NewWorkspaceService(connPool))
127+
baseserver.StartServerForTests(t, srv)
128+
129+
conn, err := grpc.Dial(srv.GRPCAddress(), grpc.WithTransportCredentials(insecure.NewCredentials()))
130+
require.NoError(t, err)
131+
132+
client := v1.NewWorkspacesServiceClient(conn)
133+
ctx := context.Background()
134+
135+
actualOwnerId, err := client.GetOwnerToken(ctx, &v1.GetOwnerTokenRequest{WorkspaceId: "some-workspace-id"})
136+
require.NoError(t, err)
137+
138+
require.Equal(t, "some-owner-token", actualOwnerId.Token)
139+
}
140+
122141
type FakeServerConnPool struct {
123142
api gitpod.APIInterface
124143
}

0 commit comments

Comments
 (0)