(v2Version string, v3Version string, minimumCLIVersion *string, authorizationPath string)
| 44 | } |
| 45 | |
| 46 | func startServerWithVersions(v2Version string, v3Version string, minimumCLIVersion *string, authorizationPath string) *Server { |
| 47 | server := NewTLSServer() |
| 48 | |
| 49 | rootResponse := fmt.Sprintf(`{ |
| 50 | "links": { |
| 51 | "self": { |
| 52 | "href": "%[1]s" |
| 53 | }, |
| 54 | "cloud_controller_v2": { |
| 55 | "href": "%[1]s/v2", |
| 56 | "meta": { |
| 57 | "version": "%[2]s" |
| 58 | } |
| 59 | }, |
| 60 | "cloud_controller_v3": { |
| 61 | "href": "%[1]s/v3", |
| 62 | "meta": { |
| 63 | "version": "%[3]s" |
| 64 | } |
| 65 | }, |
| 66 | "network_policy_v0": { |
| 67 | "href": "%[1]s/networking/v0/external" |
| 68 | }, |
| 69 | "network_policy_v1": { |
| 70 | "href": "%[1]s/networking/v1/external" |
| 71 | }, |
| 72 | "uaa": { |
| 73 | "href": "SHOULD-NOT-BE-USED-FOR-LOGGING-IN.com" |
| 74 | }, |
| 75 | "login": { |
| 76 | "href": "%[1]s" |
| 77 | }, |
| 78 | "logging": { |
| 79 | "href": "wss://unused:443" |
| 80 | }, |
| 81 | "log_cache": { |
| 82 | "href": "%[1]s" |
| 83 | }, |
| 84 | "app_ssh": { |
| 85 | "href": "unused:2222", |
| 86 | "meta": { |
| 87 | "host_key_fingerprint": "unused", |
| 88 | "oauth_client": "ssh-proxy" |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | }`, server.URL(), v2Version, v3Version) |
| 93 | |
| 94 | v2InfoResponse := struct { |
| 95 | APIVersion string `json:"api_version"` |
| 96 | AuthorizationEndpoint string `json:"authorization_endpoint"` |
| 97 | MinCLIVersion *string `json:"min_cli_version"` |
| 98 | }{ |
| 99 | APIVersion: v2Version, |
| 100 | AuthorizationEndpoint: server.URL() + authorizationPath, |
| 101 | MinCLIVersion: minimumCLIVersion} |
| 102 | |
| 103 | server.RouteToHandler(http.MethodGet, "/v2/info", RespondWithJSONEncoded(http.StatusOK, v2InfoResponse)) |
no test coverage detected