(allowOrgPorts bool)
| 128 | } |
| 129 | |
| 130 | func GetMockApi(allowOrgPorts bool) *apiClientMock { |
| 131 | return &apiClientMock{ |
| 132 | GetCodespaceFunc: func(ctx context.Context, codespaceName string, includeConnection bool) (*api.Codespace, error) { |
| 133 | allowedPortPrivacySettings := []string{"public", "private"} |
| 134 | if allowOrgPorts { |
| 135 | allowedPortPrivacySettings = append(allowedPortPrivacySettings, "org") |
| 136 | } |
| 137 | |
| 138 | return &api.Codespace{ |
| 139 | Name: "codespace-name", |
| 140 | State: api.CodespaceStateAvailable, |
| 141 | Connection: api.CodespaceConnection{ |
| 142 | TunnelProperties: api.TunnelProperties{ |
| 143 | ConnectAccessToken: "tunnel access-token", |
| 144 | ManagePortsAccessToken: "manage-ports-token", |
| 145 | ServiceUri: "http://global.rel.tunnels.api.visualstudio.com/", |
| 146 | TunnelId: "tunnel-id", |
| 147 | ClusterId: "usw2", |
| 148 | Domain: "domain.com", |
| 149 | }, |
| 150 | }, |
| 151 | RuntimeConstraints: api.RuntimeConstraints{ |
| 152 | AllowedPortPrivacySettings: allowedPortPrivacySettings, |
| 153 | }, |
| 154 | }, nil |
| 155 | }, |
| 156 | StartCodespaceFunc: func(ctx context.Context, codespaceName string) error { |
| 157 | return nil |
| 158 | }, |
| 159 | GetCodespaceRepositoryContentsFunc: func(ctx context.Context, codespace *api.Codespace, path string) ([]byte, error) { |
| 160 | return nil, nil |
| 161 | }, |
| 162 | ExternalHTTPClientFunc: func() (*http.Client, error) { |
| 163 | return connection.NewMockHttpClient() |
| 164 | }, |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | func testingPortsApp() *App { |
| 169 | disabledCodespace := &api.Codespace{ |
no test coverage detected