OLD | NEW |
1 library googleapis_beta.container.v1beta1.test; | 1 library googleapis_beta.container.v1beta1.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
7 | 7 |
8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
11 import 'package:googleapis_beta/common/common.dart' as common; | |
12 import 'package:googleapis_beta/src/common_internal.dart' as common_internal; | |
13 import '../common/common_internal_test.dart' as common_test; | |
14 | 11 |
15 import 'package:googleapis_beta/container/v1beta1.dart' as api; | 12 import 'package:googleapis_beta/container/v1beta1.dart' as api; |
16 | 13 |
| 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; |
| 16 core.bool _expectJson; |
17 | 17 |
| 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; |
| 20 _expectJson = expectJson; |
| 21 } |
| 22 |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { |
| 25 return request.finalize() |
| 26 .transform(convert.UTF8.decoder) |
| 27 .join('') |
| 28 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); |
| 31 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } |
| 34 }); |
| 35 } else { |
| 36 var stream = request.finalize(); |
| 37 if (stream == null) { |
| 38 return _callback(request, []); |
| 39 } else { |
| 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); |
| 42 }); |
| 43 } |
| 44 } |
| 45 } |
| 46 } |
| 47 |
| 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } |
18 | 53 |
19 core.int buildCounterCluster = 0; | 54 core.int buildCounterCluster = 0; |
20 buildCluster() { | 55 buildCluster() { |
21 var o = new api.Cluster(); | 56 var o = new api.Cluster(); |
22 buildCounterCluster++; | 57 buildCounterCluster++; |
23 if (buildCounterCluster < 3) { | 58 if (buildCounterCluster < 3) { |
24 o.clusterApiVersion = "foo"; | 59 o.clusterApiVersion = "foo"; |
25 o.containerIpv4Cidr = "foo"; | 60 o.containerIpv4Cidr = "foo"; |
26 o.creationTimestamp = "foo"; | 61 o.creationTimestamp = "foo"; |
27 o.description = "foo"; | 62 o.description = "foo"; |
| 63 o.enableCloudLogging = true; |
28 o.endpoint = "foo"; | 64 o.endpoint = "foo"; |
29 o.masterAuth = buildMasterAuth(); | 65 o.masterAuth = buildMasterAuth(); |
30 o.name = "foo"; | 66 o.name = "foo"; |
31 o.network = "foo"; | 67 o.network = "foo"; |
32 o.nodeConfig = buildNodeConfig(); | 68 o.nodeConfig = buildNodeConfig(); |
33 o.nodeRoutingPrefixSize = 42; | 69 o.nodeRoutingPrefixSize = 42; |
34 o.numNodes = 42; | 70 o.numNodes = 42; |
35 o.selfLink = "foo"; | 71 o.selfLink = "foo"; |
36 o.servicesIpv4Cidr = "foo"; | 72 o.servicesIpv4Cidr = "foo"; |
37 o.status = "foo"; | 73 o.status = "foo"; |
38 o.statusMessage = "foo"; | 74 o.statusMessage = "foo"; |
39 o.zone = "foo"; | 75 o.zone = "foo"; |
40 } | 76 } |
41 buildCounterCluster--; | 77 buildCounterCluster--; |
42 return o; | 78 return o; |
43 } | 79 } |
44 | 80 |
45 checkCluster(api.Cluster o) { | 81 checkCluster(api.Cluster o) { |
46 buildCounterCluster++; | 82 buildCounterCluster++; |
47 if (buildCounterCluster < 3) { | 83 if (buildCounterCluster < 3) { |
48 unittest.expect(o.clusterApiVersion, unittest.equals('foo')); | 84 unittest.expect(o.clusterApiVersion, unittest.equals('foo')); |
49 unittest.expect(o.containerIpv4Cidr, unittest.equals('foo')); | 85 unittest.expect(o.containerIpv4Cidr, unittest.equals('foo')); |
50 unittest.expect(o.creationTimestamp, unittest.equals('foo')); | 86 unittest.expect(o.creationTimestamp, unittest.equals('foo')); |
51 unittest.expect(o.description, unittest.equals('foo')); | 87 unittest.expect(o.description, unittest.equals('foo')); |
| 88 unittest.expect(o.enableCloudLogging, unittest.isTrue); |
52 unittest.expect(o.endpoint, unittest.equals('foo')); | 89 unittest.expect(o.endpoint, unittest.equals('foo')); |
53 checkMasterAuth(o.masterAuth); | 90 checkMasterAuth(o.masterAuth); |
54 unittest.expect(o.name, unittest.equals('foo')); | 91 unittest.expect(o.name, unittest.equals('foo')); |
55 unittest.expect(o.network, unittest.equals('foo')); | 92 unittest.expect(o.network, unittest.equals('foo')); |
56 checkNodeConfig(o.nodeConfig); | 93 checkNodeConfig(o.nodeConfig); |
57 unittest.expect(o.nodeRoutingPrefixSize, unittest.equals(42)); | 94 unittest.expect(o.nodeRoutingPrefixSize, unittest.equals(42)); |
58 unittest.expect(o.numNodes, unittest.equals(42)); | 95 unittest.expect(o.numNodes, unittest.equals(42)); |
59 unittest.expect(o.selfLink, unittest.equals('foo')); | 96 unittest.expect(o.selfLink, unittest.equals('foo')); |
60 unittest.expect(o.servicesIpv4Cidr, unittest.equals('foo')); | 97 unittest.expect(o.servicesIpv4Cidr, unittest.equals('foo')); |
61 unittest.expect(o.status, unittest.equals('foo')); | 98 unittest.expect(o.status, unittest.equals('foo')); |
(...skipping 15 matching lines...) Expand all Loading... |
77 } | 114 } |
78 | 115 |
79 checkCreateClusterRequest(api.CreateClusterRequest o) { | 116 checkCreateClusterRequest(api.CreateClusterRequest o) { |
80 buildCounterCreateClusterRequest++; | 117 buildCounterCreateClusterRequest++; |
81 if (buildCounterCreateClusterRequest < 3) { | 118 if (buildCounterCreateClusterRequest < 3) { |
82 checkCluster(o.cluster); | 119 checkCluster(o.cluster); |
83 } | 120 } |
84 buildCounterCreateClusterRequest--; | 121 buildCounterCreateClusterRequest--; |
85 } | 122 } |
86 | 123 |
87 buildUnnamed1565() { | 124 buildUnnamed1486() { |
88 var o = new core.List<api.Cluster>(); | 125 var o = new core.List<api.Cluster>(); |
89 o.add(buildCluster()); | 126 o.add(buildCluster()); |
90 o.add(buildCluster()); | 127 o.add(buildCluster()); |
91 return o; | 128 return o; |
92 } | 129 } |
93 | 130 |
94 checkUnnamed1565(core.List<api.Cluster> o) { | 131 checkUnnamed1486(core.List<api.Cluster> o) { |
95 unittest.expect(o, unittest.hasLength(2)); | 132 unittest.expect(o, unittest.hasLength(2)); |
96 checkCluster(o[0]); | 133 checkCluster(o[0]); |
97 checkCluster(o[1]); | 134 checkCluster(o[1]); |
98 } | 135 } |
99 | 136 |
100 core.int buildCounterListAggregatedClustersResponse = 0; | 137 core.int buildCounterListAggregatedClustersResponse = 0; |
101 buildListAggregatedClustersResponse() { | 138 buildListAggregatedClustersResponse() { |
102 var o = new api.ListAggregatedClustersResponse(); | 139 var o = new api.ListAggregatedClustersResponse(); |
103 buildCounterListAggregatedClustersResponse++; | 140 buildCounterListAggregatedClustersResponse++; |
104 if (buildCounterListAggregatedClustersResponse < 3) { | 141 if (buildCounterListAggregatedClustersResponse < 3) { |
105 o.clusters = buildUnnamed1565(); | 142 o.clusters = buildUnnamed1486(); |
106 } | 143 } |
107 buildCounterListAggregatedClustersResponse--; | 144 buildCounterListAggregatedClustersResponse--; |
108 return o; | 145 return o; |
109 } | 146 } |
110 | 147 |
111 checkListAggregatedClustersResponse(api.ListAggregatedClustersResponse o) { | 148 checkListAggregatedClustersResponse(api.ListAggregatedClustersResponse o) { |
112 buildCounterListAggregatedClustersResponse++; | 149 buildCounterListAggregatedClustersResponse++; |
113 if (buildCounterListAggregatedClustersResponse < 3) { | 150 if (buildCounterListAggregatedClustersResponse < 3) { |
114 checkUnnamed1565(o.clusters); | 151 checkUnnamed1486(o.clusters); |
115 } | 152 } |
116 buildCounterListAggregatedClustersResponse--; | 153 buildCounterListAggregatedClustersResponse--; |
117 } | 154 } |
118 | 155 |
119 buildUnnamed1566() { | 156 buildUnnamed1487() { |
120 var o = new core.List<api.Operation>(); | 157 var o = new core.List<api.Operation>(); |
121 o.add(buildOperation()); | 158 o.add(buildOperation()); |
122 o.add(buildOperation()); | 159 o.add(buildOperation()); |
123 return o; | 160 return o; |
124 } | 161 } |
125 | 162 |
126 checkUnnamed1566(core.List<api.Operation> o) { | 163 checkUnnamed1487(core.List<api.Operation> o) { |
127 unittest.expect(o, unittest.hasLength(2)); | 164 unittest.expect(o, unittest.hasLength(2)); |
128 checkOperation(o[0]); | 165 checkOperation(o[0]); |
129 checkOperation(o[1]); | 166 checkOperation(o[1]); |
130 } | 167 } |
131 | 168 |
132 core.int buildCounterListAggregatedOperationsResponse = 0; | 169 core.int buildCounterListAggregatedOperationsResponse = 0; |
133 buildListAggregatedOperationsResponse() { | 170 buildListAggregatedOperationsResponse() { |
134 var o = new api.ListAggregatedOperationsResponse(); | 171 var o = new api.ListAggregatedOperationsResponse(); |
135 buildCounterListAggregatedOperationsResponse++; | 172 buildCounterListAggregatedOperationsResponse++; |
136 if (buildCounterListAggregatedOperationsResponse < 3) { | 173 if (buildCounterListAggregatedOperationsResponse < 3) { |
137 o.operations = buildUnnamed1566(); | 174 o.operations = buildUnnamed1487(); |
138 } | 175 } |
139 buildCounterListAggregatedOperationsResponse--; | 176 buildCounterListAggregatedOperationsResponse--; |
140 return o; | 177 return o; |
141 } | 178 } |
142 | 179 |
143 checkListAggregatedOperationsResponse(api.ListAggregatedOperationsResponse o) { | 180 checkListAggregatedOperationsResponse(api.ListAggregatedOperationsResponse o) { |
144 buildCounterListAggregatedOperationsResponse++; | 181 buildCounterListAggregatedOperationsResponse++; |
145 if (buildCounterListAggregatedOperationsResponse < 3) { | 182 if (buildCounterListAggregatedOperationsResponse < 3) { |
146 checkUnnamed1566(o.operations); | 183 checkUnnamed1487(o.operations); |
147 } | 184 } |
148 buildCounterListAggregatedOperationsResponse--; | 185 buildCounterListAggregatedOperationsResponse--; |
149 } | 186 } |
150 | 187 |
151 buildUnnamed1567() { | 188 buildUnnamed1488() { |
152 var o = new core.List<api.Cluster>(); | 189 var o = new core.List<api.Cluster>(); |
153 o.add(buildCluster()); | 190 o.add(buildCluster()); |
154 o.add(buildCluster()); | 191 o.add(buildCluster()); |
155 return o; | 192 return o; |
156 } | 193 } |
157 | 194 |
158 checkUnnamed1567(core.List<api.Cluster> o) { | 195 checkUnnamed1488(core.List<api.Cluster> o) { |
159 unittest.expect(o, unittest.hasLength(2)); | 196 unittest.expect(o, unittest.hasLength(2)); |
160 checkCluster(o[0]); | 197 checkCluster(o[0]); |
161 checkCluster(o[1]); | 198 checkCluster(o[1]); |
162 } | 199 } |
163 | 200 |
164 core.int buildCounterListClustersResponse = 0; | 201 core.int buildCounterListClustersResponse = 0; |
165 buildListClustersResponse() { | 202 buildListClustersResponse() { |
166 var o = new api.ListClustersResponse(); | 203 var o = new api.ListClustersResponse(); |
167 buildCounterListClustersResponse++; | 204 buildCounterListClustersResponse++; |
168 if (buildCounterListClustersResponse < 3) { | 205 if (buildCounterListClustersResponse < 3) { |
169 o.clusters = buildUnnamed1567(); | 206 o.clusters = buildUnnamed1488(); |
170 } | 207 } |
171 buildCounterListClustersResponse--; | 208 buildCounterListClustersResponse--; |
172 return o; | 209 return o; |
173 } | 210 } |
174 | 211 |
175 checkListClustersResponse(api.ListClustersResponse o) { | 212 checkListClustersResponse(api.ListClustersResponse o) { |
176 buildCounterListClustersResponse++; | 213 buildCounterListClustersResponse++; |
177 if (buildCounterListClustersResponse < 3) { | 214 if (buildCounterListClustersResponse < 3) { |
178 checkUnnamed1567(o.clusters); | 215 checkUnnamed1488(o.clusters); |
179 } | 216 } |
180 buildCounterListClustersResponse--; | 217 buildCounterListClustersResponse--; |
181 } | 218 } |
182 | 219 |
183 buildUnnamed1568() { | 220 buildUnnamed1489() { |
184 var o = new core.List<api.Operation>(); | 221 var o = new core.List<api.Operation>(); |
185 o.add(buildOperation()); | 222 o.add(buildOperation()); |
186 o.add(buildOperation()); | 223 o.add(buildOperation()); |
187 return o; | 224 return o; |
188 } | 225 } |
189 | 226 |
190 checkUnnamed1568(core.List<api.Operation> o) { | 227 checkUnnamed1489(core.List<api.Operation> o) { |
191 unittest.expect(o, unittest.hasLength(2)); | 228 unittest.expect(o, unittest.hasLength(2)); |
192 checkOperation(o[0]); | 229 checkOperation(o[0]); |
193 checkOperation(o[1]); | 230 checkOperation(o[1]); |
194 } | 231 } |
195 | 232 |
196 core.int buildCounterListOperationsResponse = 0; | 233 core.int buildCounterListOperationsResponse = 0; |
197 buildListOperationsResponse() { | 234 buildListOperationsResponse() { |
198 var o = new api.ListOperationsResponse(); | 235 var o = new api.ListOperationsResponse(); |
199 buildCounterListOperationsResponse++; | 236 buildCounterListOperationsResponse++; |
200 if (buildCounterListOperationsResponse < 3) { | 237 if (buildCounterListOperationsResponse < 3) { |
201 o.operations = buildUnnamed1568(); | 238 o.operations = buildUnnamed1489(); |
202 } | 239 } |
203 buildCounterListOperationsResponse--; | 240 buildCounterListOperationsResponse--; |
204 return o; | 241 return o; |
205 } | 242 } |
206 | 243 |
207 checkListOperationsResponse(api.ListOperationsResponse o) { | 244 checkListOperationsResponse(api.ListOperationsResponse o) { |
208 buildCounterListOperationsResponse++; | 245 buildCounterListOperationsResponse++; |
209 if (buildCounterListOperationsResponse < 3) { | 246 if (buildCounterListOperationsResponse < 3) { |
210 checkUnnamed1568(o.operations); | 247 checkUnnamed1489(o.operations); |
211 } | 248 } |
212 buildCounterListOperationsResponse--; | 249 buildCounterListOperationsResponse--; |
213 } | 250 } |
214 | 251 |
215 core.int buildCounterMasterAuth = 0; | 252 core.int buildCounterMasterAuth = 0; |
216 buildMasterAuth() { | 253 buildMasterAuth() { |
217 var o = new api.MasterAuth(); | 254 var o = new api.MasterAuth(); |
218 buildCounterMasterAuth++; | 255 buildCounterMasterAuth++; |
219 if (buildCounterMasterAuth < 3) { | 256 if (buildCounterMasterAuth < 3) { |
220 o.password = "foo"; | 257 o.password = "foo"; |
221 o.user = "foo"; | 258 o.user = "foo"; |
222 } | 259 } |
223 buildCounterMasterAuth--; | 260 buildCounterMasterAuth--; |
224 return o; | 261 return o; |
225 } | 262 } |
226 | 263 |
227 checkMasterAuth(api.MasterAuth o) { | 264 checkMasterAuth(api.MasterAuth o) { |
228 buildCounterMasterAuth++; | 265 buildCounterMasterAuth++; |
229 if (buildCounterMasterAuth < 3) { | 266 if (buildCounterMasterAuth < 3) { |
230 unittest.expect(o.password, unittest.equals('foo')); | 267 unittest.expect(o.password, unittest.equals('foo')); |
231 unittest.expect(o.user, unittest.equals('foo')); | 268 unittest.expect(o.user, unittest.equals('foo')); |
232 } | 269 } |
233 buildCounterMasterAuth--; | 270 buildCounterMasterAuth--; |
234 } | 271 } |
235 | 272 |
236 buildUnnamed1569() { | 273 buildUnnamed1490() { |
237 var o = new core.List<api.ServiceAccount>(); | 274 var o = new core.List<api.ServiceAccount>(); |
238 o.add(buildServiceAccount()); | 275 o.add(buildServiceAccount()); |
239 o.add(buildServiceAccount()); | 276 o.add(buildServiceAccount()); |
240 return o; | 277 return o; |
241 } | 278 } |
242 | 279 |
243 checkUnnamed1569(core.List<api.ServiceAccount> o) { | 280 checkUnnamed1490(core.List<api.ServiceAccount> o) { |
244 unittest.expect(o, unittest.hasLength(2)); | 281 unittest.expect(o, unittest.hasLength(2)); |
245 checkServiceAccount(o[0]); | 282 checkServiceAccount(o[0]); |
246 checkServiceAccount(o[1]); | 283 checkServiceAccount(o[1]); |
247 } | 284 } |
248 | 285 |
249 core.int buildCounterNodeConfig = 0; | 286 core.int buildCounterNodeConfig = 0; |
250 buildNodeConfig() { | 287 buildNodeConfig() { |
251 var o = new api.NodeConfig(); | 288 var o = new api.NodeConfig(); |
252 buildCounterNodeConfig++; | 289 buildCounterNodeConfig++; |
253 if (buildCounterNodeConfig < 3) { | 290 if (buildCounterNodeConfig < 3) { |
254 o.machineType = "foo"; | 291 o.machineType = "foo"; |
255 o.serviceAccounts = buildUnnamed1569(); | 292 o.serviceAccounts = buildUnnamed1490(); |
256 o.sourceImage = "foo"; | 293 o.sourceImage = "foo"; |
257 } | 294 } |
258 buildCounterNodeConfig--; | 295 buildCounterNodeConfig--; |
259 return o; | 296 return o; |
260 } | 297 } |
261 | 298 |
262 checkNodeConfig(api.NodeConfig o) { | 299 checkNodeConfig(api.NodeConfig o) { |
263 buildCounterNodeConfig++; | 300 buildCounterNodeConfig++; |
264 if (buildCounterNodeConfig < 3) { | 301 if (buildCounterNodeConfig < 3) { |
265 unittest.expect(o.machineType, unittest.equals('foo')); | 302 unittest.expect(o.machineType, unittest.equals('foo')); |
266 checkUnnamed1569(o.serviceAccounts); | 303 checkUnnamed1490(o.serviceAccounts); |
267 unittest.expect(o.sourceImage, unittest.equals('foo')); | 304 unittest.expect(o.sourceImage, unittest.equals('foo')); |
268 } | 305 } |
269 buildCounterNodeConfig--; | 306 buildCounterNodeConfig--; |
270 } | 307 } |
271 | 308 |
272 core.int buildCounterOperation = 0; | 309 core.int buildCounterOperation = 0; |
273 buildOperation() { | 310 buildOperation() { |
274 var o = new api.Operation(); | 311 var o = new api.Operation(); |
275 buildCounterOperation++; | 312 buildCounterOperation++; |
276 if (buildCounterOperation < 3) { | 313 if (buildCounterOperation < 3) { |
(...skipping 18 matching lines...) Expand all Loading... |
295 unittest.expect(o.operationType, unittest.equals('foo')); | 332 unittest.expect(o.operationType, unittest.equals('foo')); |
296 unittest.expect(o.selfLink, unittest.equals('foo')); | 333 unittest.expect(o.selfLink, unittest.equals('foo')); |
297 unittest.expect(o.status, unittest.equals('foo')); | 334 unittest.expect(o.status, unittest.equals('foo')); |
298 unittest.expect(o.target, unittest.equals('foo')); | 335 unittest.expect(o.target, unittest.equals('foo')); |
299 unittest.expect(o.targetLink, unittest.equals('foo')); | 336 unittest.expect(o.targetLink, unittest.equals('foo')); |
300 unittest.expect(o.zone, unittest.equals('foo')); | 337 unittest.expect(o.zone, unittest.equals('foo')); |
301 } | 338 } |
302 buildCounterOperation--; | 339 buildCounterOperation--; |
303 } | 340 } |
304 | 341 |
305 buildUnnamed1570() { | 342 buildUnnamed1491() { |
306 var o = new core.List<core.String>(); | 343 var o = new core.List<core.String>(); |
307 o.add("foo"); | 344 o.add("foo"); |
308 o.add("foo"); | 345 o.add("foo"); |
309 return o; | 346 return o; |
310 } | 347 } |
311 | 348 |
312 checkUnnamed1570(core.List<core.String> o) { | 349 checkUnnamed1491(core.List<core.String> o) { |
313 unittest.expect(o, unittest.hasLength(2)); | 350 unittest.expect(o, unittest.hasLength(2)); |
314 unittest.expect(o[0], unittest.equals('foo')); | 351 unittest.expect(o[0], unittest.equals('foo')); |
315 unittest.expect(o[1], unittest.equals('foo')); | 352 unittest.expect(o[1], unittest.equals('foo')); |
316 } | 353 } |
317 | 354 |
318 core.int buildCounterServiceAccount = 0; | 355 core.int buildCounterServiceAccount = 0; |
319 buildServiceAccount() { | 356 buildServiceAccount() { |
320 var o = new api.ServiceAccount(); | 357 var o = new api.ServiceAccount(); |
321 buildCounterServiceAccount++; | 358 buildCounterServiceAccount++; |
322 if (buildCounterServiceAccount < 3) { | 359 if (buildCounterServiceAccount < 3) { |
323 o.email = "foo"; | 360 o.email = "foo"; |
324 o.scopes = buildUnnamed1570(); | 361 o.scopes = buildUnnamed1491(); |
325 } | 362 } |
326 buildCounterServiceAccount--; | 363 buildCounterServiceAccount--; |
327 return o; | 364 return o; |
328 } | 365 } |
329 | 366 |
330 checkServiceAccount(api.ServiceAccount o) { | 367 checkServiceAccount(api.ServiceAccount o) { |
331 buildCounterServiceAccount++; | 368 buildCounterServiceAccount++; |
332 if (buildCounterServiceAccount < 3) { | 369 if (buildCounterServiceAccount < 3) { |
333 unittest.expect(o.email, unittest.equals('foo')); | 370 unittest.expect(o.email, unittest.equals('foo')); |
334 checkUnnamed1570(o.scopes); | 371 checkUnnamed1491(o.scopes); |
335 } | 372 } |
336 buildCounterServiceAccount--; | 373 buildCounterServiceAccount--; |
337 } | 374 } |
338 | 375 |
339 | 376 |
340 main() { | 377 main() { |
341 unittest.group("obj-schema-Cluster", () { | 378 unittest.group("obj-schema-Cluster", () { |
342 unittest.test("to-json--from-json", () { | 379 unittest.test("to-json--from-json", () { |
343 var o = buildCluster(); | 380 var o = buildCluster(); |
344 var od = new api.Cluster.fromJson(o.toJson()); | 381 var od = new api.Cluster.fromJson(o.toJson()); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 var o = buildServiceAccount(); | 461 var o = buildServiceAccount(); |
425 var od = new api.ServiceAccount.fromJson(o.toJson()); | 462 var od = new api.ServiceAccount.fromJson(o.toJson()); |
426 checkServiceAccount(od); | 463 checkServiceAccount(od); |
427 }); | 464 }); |
428 }); | 465 }); |
429 | 466 |
430 | 467 |
431 unittest.group("resource-ProjectsClustersResourceApi", () { | 468 unittest.group("resource-ProjectsClustersResourceApi", () { |
432 unittest.test("method--list", () { | 469 unittest.test("method--list", () { |
433 | 470 |
434 var mock = new common_test.HttpServerMock(); | 471 var mock = new HttpServerMock(); |
435 api.ProjectsClustersResourceApi res = new api.ContainerApi(mock).projects.
clusters; | 472 api.ProjectsClustersResourceApi res = new api.ContainerApi(mock).projects.
clusters; |
436 var arg_projectId = "foo"; | 473 var arg_projectId = "foo"; |
437 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 474 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
438 var path = (req.url).path; | 475 var path = (req.url).path; |
439 var pathOffset = 0; | 476 var pathOffset = 0; |
440 var index; | 477 var index; |
441 var subPart; | 478 var subPart; |
442 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 479 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
443 pathOffset += 1; | 480 pathOffset += 1; |
444 | 481 |
(...skipping 12 matching lines...) Expand all Loading... |
457 var keyvalue = part.split("="); | 494 var keyvalue = part.split("="); |
458 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 495 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
459 } | 496 } |
460 } | 497 } |
461 | 498 |
462 | 499 |
463 var h = { | 500 var h = { |
464 "content-type" : "application/json; charset=utf-8", | 501 "content-type" : "application/json; charset=utf-8", |
465 }; | 502 }; |
466 var resp = convert.JSON.encode(buildListAggregatedClustersResponse()); | 503 var resp = convert.JSON.encode(buildListAggregatedClustersResponse()); |
467 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 504 return new async.Future.value(stringResponse(200, h, resp)); |
468 }), true); | 505 }), true); |
469 res.list(arg_projectId).then(unittest.expectAsync(((api.ListAggregatedClus
tersResponse response) { | 506 res.list(arg_projectId).then(unittest.expectAsync(((api.ListAggregatedClus
tersResponse response) { |
470 checkListAggregatedClustersResponse(response); | 507 checkListAggregatedClustersResponse(response); |
471 }))); | 508 }))); |
472 }); | 509 }); |
473 | 510 |
474 }); | 511 }); |
475 | 512 |
476 | 513 |
477 unittest.group("resource-ProjectsOperationsResourceApi", () { | 514 unittest.group("resource-ProjectsOperationsResourceApi", () { |
478 unittest.test("method--list", () { | 515 unittest.test("method--list", () { |
479 | 516 |
480 var mock = new common_test.HttpServerMock(); | 517 var mock = new HttpServerMock(); |
481 api.ProjectsOperationsResourceApi res = new api.ContainerApi(mock).project
s.operations; | 518 api.ProjectsOperationsResourceApi res = new api.ContainerApi(mock).project
s.operations; |
482 var arg_projectId = "foo"; | 519 var arg_projectId = "foo"; |
483 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 520 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
484 var path = (req.url).path; | 521 var path = (req.url).path; |
485 var pathOffset = 0; | 522 var pathOffset = 0; |
486 var index; | 523 var index; |
487 var subPart; | 524 var subPart; |
488 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 525 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
489 pathOffset += 1; | 526 pathOffset += 1; |
490 | 527 |
(...skipping 12 matching lines...) Expand all Loading... |
503 var keyvalue = part.split("="); | 540 var keyvalue = part.split("="); |
504 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 541 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
505 } | 542 } |
506 } | 543 } |
507 | 544 |
508 | 545 |
509 var h = { | 546 var h = { |
510 "content-type" : "application/json; charset=utf-8", | 547 "content-type" : "application/json; charset=utf-8", |
511 }; | 548 }; |
512 var resp = convert.JSON.encode(buildListAggregatedOperationsResponse()); | 549 var resp = convert.JSON.encode(buildListAggregatedOperationsResponse()); |
513 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 550 return new async.Future.value(stringResponse(200, h, resp)); |
514 }), true); | 551 }), true); |
515 res.list(arg_projectId).then(unittest.expectAsync(((api.ListAggregatedOper
ationsResponse response) { | 552 res.list(arg_projectId).then(unittest.expectAsync(((api.ListAggregatedOper
ationsResponse response) { |
516 checkListAggregatedOperationsResponse(response); | 553 checkListAggregatedOperationsResponse(response); |
517 }))); | 554 }))); |
518 }); | 555 }); |
519 | 556 |
520 }); | 557 }); |
521 | 558 |
522 | 559 |
523 unittest.group("resource-ProjectsZonesClustersResourceApi", () { | 560 unittest.group("resource-ProjectsZonesClustersResourceApi", () { |
524 unittest.test("method--create", () { | 561 unittest.test("method--create", () { |
525 | 562 |
526 var mock = new common_test.HttpServerMock(); | 563 var mock = new HttpServerMock(); |
527 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; | 564 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; |
528 var arg_request = buildCreateClusterRequest(); | 565 var arg_request = buildCreateClusterRequest(); |
529 var arg_projectId = "foo"; | 566 var arg_projectId = "foo"; |
530 var arg_zoneId = "foo"; | 567 var arg_zoneId = "foo"; |
531 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 568 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
532 var obj = new api.CreateClusterRequest.fromJson(json); | 569 var obj = new api.CreateClusterRequest.fromJson(json); |
533 checkCreateClusterRequest(obj); | 570 checkCreateClusterRequest(obj); |
534 | 571 |
535 var path = (req.url).path; | 572 var path = (req.url).path; |
536 var pathOffset = 0; | 573 var pathOffset = 0; |
(...skipping 17 matching lines...) Expand all Loading... |
554 var keyvalue = part.split("="); | 591 var keyvalue = part.split("="); |
555 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 592 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
556 } | 593 } |
557 } | 594 } |
558 | 595 |
559 | 596 |
560 var h = { | 597 var h = { |
561 "content-type" : "application/json; charset=utf-8", | 598 "content-type" : "application/json; charset=utf-8", |
562 }; | 599 }; |
563 var resp = convert.JSON.encode(buildOperation()); | 600 var resp = convert.JSON.encode(buildOperation()); |
564 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 601 return new async.Future.value(stringResponse(200, h, resp)); |
565 }), true); | 602 }), true); |
566 res.create(arg_request, arg_projectId, arg_zoneId).then(unittest.expectAsy
nc(((api.Operation response) { | 603 res.create(arg_request, arg_projectId, arg_zoneId).then(unittest.expectAsy
nc(((api.Operation response) { |
567 checkOperation(response); | 604 checkOperation(response); |
568 }))); | 605 }))); |
569 }); | 606 }); |
570 | 607 |
571 unittest.test("method--delete", () { | 608 unittest.test("method--delete", () { |
572 | 609 |
573 var mock = new common_test.HttpServerMock(); | 610 var mock = new HttpServerMock(); |
574 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; | 611 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; |
575 var arg_projectId = "foo"; | 612 var arg_projectId = "foo"; |
576 var arg_zoneId = "foo"; | 613 var arg_zoneId = "foo"; |
577 var arg_clusterId = "foo"; | 614 var arg_clusterId = "foo"; |
578 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 615 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
579 var path = (req.url).path; | 616 var path = (req.url).path; |
580 var pathOffset = 0; | 617 var pathOffset = 0; |
581 var index; | 618 var index; |
582 var subPart; | 619 var subPart; |
583 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 620 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
(...skipping 14 matching lines...) Expand all Loading... |
598 var keyvalue = part.split("="); | 635 var keyvalue = part.split("="); |
599 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 636 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
600 } | 637 } |
601 } | 638 } |
602 | 639 |
603 | 640 |
604 var h = { | 641 var h = { |
605 "content-type" : "application/json; charset=utf-8", | 642 "content-type" : "application/json; charset=utf-8", |
606 }; | 643 }; |
607 var resp = convert.JSON.encode(buildOperation()); | 644 var resp = convert.JSON.encode(buildOperation()); |
608 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 645 return new async.Future.value(stringResponse(200, h, resp)); |
609 }), true); | 646 }), true); |
610 res.delete(arg_projectId, arg_zoneId, arg_clusterId).then(unittest.expectA
sync(((api.Operation response) { | 647 res.delete(arg_projectId, arg_zoneId, arg_clusterId).then(unittest.expectA
sync(((api.Operation response) { |
611 checkOperation(response); | 648 checkOperation(response); |
612 }))); | 649 }))); |
613 }); | 650 }); |
614 | 651 |
615 unittest.test("method--get", () { | 652 unittest.test("method--get", () { |
616 | 653 |
617 var mock = new common_test.HttpServerMock(); | 654 var mock = new HttpServerMock(); |
618 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; | 655 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; |
619 var arg_projectId = "foo"; | 656 var arg_projectId = "foo"; |
620 var arg_zoneId = "foo"; | 657 var arg_zoneId = "foo"; |
621 var arg_clusterId = "foo"; | 658 var arg_clusterId = "foo"; |
622 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 659 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
623 var path = (req.url).path; | 660 var path = (req.url).path; |
624 var pathOffset = 0; | 661 var pathOffset = 0; |
625 var index; | 662 var index; |
626 var subPart; | 663 var subPart; |
627 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 664 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
(...skipping 14 matching lines...) Expand all Loading... |
642 var keyvalue = part.split("="); | 679 var keyvalue = part.split("="); |
643 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 680 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
644 } | 681 } |
645 } | 682 } |
646 | 683 |
647 | 684 |
648 var h = { | 685 var h = { |
649 "content-type" : "application/json; charset=utf-8", | 686 "content-type" : "application/json; charset=utf-8", |
650 }; | 687 }; |
651 var resp = convert.JSON.encode(buildCluster()); | 688 var resp = convert.JSON.encode(buildCluster()); |
652 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 689 return new async.Future.value(stringResponse(200, h, resp)); |
653 }), true); | 690 }), true); |
654 res.get(arg_projectId, arg_zoneId, arg_clusterId).then(unittest.expectAsyn
c(((api.Cluster response) { | 691 res.get(arg_projectId, arg_zoneId, arg_clusterId).then(unittest.expectAsyn
c(((api.Cluster response) { |
655 checkCluster(response); | 692 checkCluster(response); |
656 }))); | 693 }))); |
657 }); | 694 }); |
658 | 695 |
659 unittest.test("method--list", () { | 696 unittest.test("method--list", () { |
660 | 697 |
661 var mock = new common_test.HttpServerMock(); | 698 var mock = new HttpServerMock(); |
662 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; | 699 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; |
663 var arg_projectId = "foo"; | 700 var arg_projectId = "foo"; |
664 var arg_zoneId = "foo"; | 701 var arg_zoneId = "foo"; |
665 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 702 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
666 var path = (req.url).path; | 703 var path = (req.url).path; |
667 var pathOffset = 0; | 704 var pathOffset = 0; |
668 var index; | 705 var index; |
669 var subPart; | 706 var subPart; |
670 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 707 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
671 pathOffset += 1; | 708 pathOffset += 1; |
(...skipping 13 matching lines...) Expand all Loading... |
685 var keyvalue = part.split("="); | 722 var keyvalue = part.split("="); |
686 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 723 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
687 } | 724 } |
688 } | 725 } |
689 | 726 |
690 | 727 |
691 var h = { | 728 var h = { |
692 "content-type" : "application/json; charset=utf-8", | 729 "content-type" : "application/json; charset=utf-8", |
693 }; | 730 }; |
694 var resp = convert.JSON.encode(buildListClustersResponse()); | 731 var resp = convert.JSON.encode(buildListClustersResponse()); |
695 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 732 return new async.Future.value(stringResponse(200, h, resp)); |
696 }), true); | 733 }), true); |
697 res.list(arg_projectId, arg_zoneId).then(unittest.expectAsync(((api.ListCl
ustersResponse response) { | 734 res.list(arg_projectId, arg_zoneId).then(unittest.expectAsync(((api.ListCl
ustersResponse response) { |
698 checkListClustersResponse(response); | 735 checkListClustersResponse(response); |
699 }))); | 736 }))); |
700 }); | 737 }); |
701 | 738 |
702 }); | 739 }); |
703 | 740 |
704 | 741 |
705 unittest.group("resource-ProjectsZonesOperationsResourceApi", () { | 742 unittest.group("resource-ProjectsZonesOperationsResourceApi", () { |
706 unittest.test("method--get", () { | 743 unittest.test("method--get", () { |
707 | 744 |
708 var mock = new common_test.HttpServerMock(); | 745 var mock = new HttpServerMock(); |
709 api.ProjectsZonesOperationsResourceApi res = new api.ContainerApi(mock).pr
ojects.zones.operations; | 746 api.ProjectsZonesOperationsResourceApi res = new api.ContainerApi(mock).pr
ojects.zones.operations; |
710 var arg_projectId = "foo"; | 747 var arg_projectId = "foo"; |
711 var arg_zoneId = "foo"; | 748 var arg_zoneId = "foo"; |
712 var arg_operationId = "foo"; | 749 var arg_operationId = "foo"; |
713 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 750 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
714 var path = (req.url).path; | 751 var path = (req.url).path; |
715 var pathOffset = 0; | 752 var pathOffset = 0; |
716 var index; | 753 var index; |
717 var subPart; | 754 var subPart; |
718 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 755 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
(...skipping 14 matching lines...) Expand all Loading... |
733 var keyvalue = part.split("="); | 770 var keyvalue = part.split("="); |
734 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 771 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
735 } | 772 } |
736 } | 773 } |
737 | 774 |
738 | 775 |
739 var h = { | 776 var h = { |
740 "content-type" : "application/json; charset=utf-8", | 777 "content-type" : "application/json; charset=utf-8", |
741 }; | 778 }; |
742 var resp = convert.JSON.encode(buildOperation()); | 779 var resp = convert.JSON.encode(buildOperation()); |
743 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 780 return new async.Future.value(stringResponse(200, h, resp)); |
744 }), true); | 781 }), true); |
745 res.get(arg_projectId, arg_zoneId, arg_operationId).then(unittest.expectAs
ync(((api.Operation response) { | 782 res.get(arg_projectId, arg_zoneId, arg_operationId).then(unittest.expectAs
ync(((api.Operation response) { |
746 checkOperation(response); | 783 checkOperation(response); |
747 }))); | 784 }))); |
748 }); | 785 }); |
749 | 786 |
750 unittest.test("method--list", () { | 787 unittest.test("method--list", () { |
751 | 788 |
752 var mock = new common_test.HttpServerMock(); | 789 var mock = new HttpServerMock(); |
753 api.ProjectsZonesOperationsResourceApi res = new api.ContainerApi(mock).pr
ojects.zones.operations; | 790 api.ProjectsZonesOperationsResourceApi res = new api.ContainerApi(mock).pr
ojects.zones.operations; |
754 var arg_projectId = "foo"; | 791 var arg_projectId = "foo"; |
755 var arg_zoneId = "foo"; | 792 var arg_zoneId = "foo"; |
756 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 793 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
757 var path = (req.url).path; | 794 var path = (req.url).path; |
758 var pathOffset = 0; | 795 var pathOffset = 0; |
759 var index; | 796 var index; |
760 var subPart; | 797 var subPart; |
761 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 798 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
762 pathOffset += 1; | 799 pathOffset += 1; |
(...skipping 13 matching lines...) Expand all Loading... |
776 var keyvalue = part.split("="); | 813 var keyvalue = part.split("="); |
777 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 814 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
778 } | 815 } |
779 } | 816 } |
780 | 817 |
781 | 818 |
782 var h = { | 819 var h = { |
783 "content-type" : "application/json; charset=utf-8", | 820 "content-type" : "application/json; charset=utf-8", |
784 }; | 821 }; |
785 var resp = convert.JSON.encode(buildListOperationsResponse()); | 822 var resp = convert.JSON.encode(buildListOperationsResponse()); |
786 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 823 return new async.Future.value(stringResponse(200, h, resp)); |
787 }), true); | 824 }), true); |
788 res.list(arg_projectId, arg_zoneId).then(unittest.expectAsync(((api.ListOp
erationsResponse response) { | 825 res.list(arg_projectId, arg_zoneId).then(unittest.expectAsync(((api.ListOp
erationsResponse response) { |
789 checkListOperationsResponse(response); | 826 checkListOperationsResponse(response); |
790 }))); | 827 }))); |
791 }); | 828 }); |
792 | 829 |
793 }); | 830 }); |
794 | 831 |
795 | 832 |
796 } | 833 } |
797 | 834 |
OLD | NEW |