@@ -91,12 +91,8 @@ func TestNewCloud(t *testing.T) {
9191 "HCLOUD_METRICS_ENABLED" , "false" ,
9292 )
9393 defer resetEnv ()
94- env .Mux .HandleFunc ("/servers" , func (w http.ResponseWriter , _ * http.Request ) {
95- json .NewEncoder (w ).Encode (
96- schema.ServerListResponse {
97- Servers : []schema.Server {},
98- },
99- )
94+ env .Mux .HandleFunc ("/locations" , func (w http.ResponseWriter , _ * http.Request ) {
95+ json .NewEncoder (w ).Encode (schema.LocationListResponse {Locations : []schema.Location {}})
10096 })
10197
10298 _ , err := NewCloud (DefaultClusterCIDR )
@@ -113,7 +109,7 @@ func TestNewCloudConnectionNotPossible(t *testing.T) {
113109
114110 _ , err := NewCloud (DefaultClusterCIDR )
115111 assert .EqualError (t , err ,
116- `hcloud/newCloud: Get "http://127.0.0.1:4711/v1/servers ?": dial tcp 127.0.0.1:4711: connect: connection refused` )
112+ `hcloud/newCloud: Get "http://127.0.0.1:4711/v1/locations ?": dial tcp 127.0.0.1:4711: connect: connection refused` )
117113}
118114
119115func TestNewCloudInvalidToken (t * testing.T ) {
@@ -126,7 +122,7 @@ func TestNewCloudInvalidToken(t *testing.T) {
126122 "HCLOUD_METRICS_ENABLED" , "false" ,
127123 )
128124 defer resetEnv ()
129- env .Mux .HandleFunc ("/servers " , func (w http.ResponseWriter , _ * http.Request ) {
125+ env .Mux .HandleFunc ("/locations " , func (w http.ResponseWriter , _ * http.Request ) {
130126 w .Header ().Set ("Content-Type" , "application/json" )
131127 w .WriteHeader (http .StatusUnauthorized )
132128 json .NewEncoder (w ).Encode (
@@ -155,34 +151,8 @@ func TestCloud(t *testing.T) {
155151 "ROBOT_PASSWORD" , "pass123" ,
156152 )
157153 defer resetEnv ()
158- env .Mux .HandleFunc ("/servers" , func (w http.ResponseWriter , _ * http.Request ) {
159- json .NewEncoder (w ).Encode (
160- schema.ServerListResponse {
161- Servers : []schema.Server {
162- {
163- ID : 1 ,
164- Name : "test" ,
165- Status : "running" ,
166- Created : time.Time {},
167- PublicNet : schema.ServerPublicNet {},
168- PrivateNet : nil ,
169- ServerType : schema.ServerType {},
170- IncludedTraffic : 0 ,
171- OutgoingTraffic : nil ,
172- IngoingTraffic : nil ,
173- BackupWindow : nil ,
174- RescueEnabled : false ,
175- ISO : nil ,
176- Locked : false ,
177- Datacenter : schema.Datacenter {},
178- Image : nil ,
179- Protection : schema.ServerProtection {},
180- Labels : nil ,
181- Volumes : nil ,
182- },
183- },
184- },
185- )
154+ env .Mux .HandleFunc ("/locations" , func (w http.ResponseWriter , _ * http.Request ) {
155+ json .NewEncoder (w ).Encode (schema.LocationListResponse {Locations : []schema.Location {}})
186156 })
187157 env .Mux .HandleFunc ("/networks/1" , func (w http.ResponseWriter , _ * http.Request ) {
188158 json .NewEncoder (w ).Encode (
0 commit comments