(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestNewPortForwarder(t *testing.T) { |
| 16 | ctx := context.Background() |
| 17 | |
| 18 | // Create a mock codespace |
| 19 | codespace := &api.Codespace{ |
| 20 | Connection: api.CodespaceConnection{ |
| 21 | TunnelProperties: api.TunnelProperties{ |
| 22 | ConnectAccessToken: "connect-token", |
| 23 | ManagePortsAccessToken: "manage-ports-token", |
| 24 | ServiceUri: "http://global.rel.tunnels.api.visualstudio.com/", |
| 25 | TunnelId: "tunnel-id", |
| 26 | ClusterId: "usw2", |
| 27 | Domain: "domain.com", |
| 28 | }, |
| 29 | }, |
| 30 | RuntimeConstraints: api.RuntimeConstraints{ |
| 31 | AllowedPortPrivacySettings: []string{"public", "private"}, |
| 32 | }, |
| 33 | } |
| 34 | |
| 35 | // Create the mock HTTP client |
| 36 | httpClient, err := connection.NewMockHttpClient() |
| 37 | require.NoError(t, err) |
| 38 | |
| 39 | // Call the function being tested |
| 40 | conn, err := connection.NewCodespaceConnection(ctx, codespace, httpClient) |
| 41 | require.NoError(t, err) |
| 42 | |
| 43 | // Create the new port forwarder |
| 44 | portForwarder, err := NewPortForwarder(ctx, conn) |
| 45 | require.NoError(t, err) |
| 46 | require.NotNil(t, portForwarder) |
| 47 | } |
| 48 | |
| 49 | func TestAccessControlEntriesToVisibility(t *testing.T) { |
| 50 | publicAccessControlEntry := []tunnels.TunnelAccessControlEntry{{ |
nothing calls this directly
no test coverage detected