| OLD | NEW |
| 1 library googleapis_beta.container.v1beta1.test; | 1 library googleapis.container.v1.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 | 11 |
| 12 import 'package:googleapis_beta/container/v1beta1.dart' as api; | 12 import 'package:googleapis/container/v1.dart' as api; |
| 13 | 13 |
| 14 class HttpServerMock extends http.BaseClient { | 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; | 15 core.Function _callback; |
| 16 core.bool _expectJson; | 16 core.bool _expectJson; |
| 17 | 17 |
| 18 void register(core.Function callback, core.bool expectJson) { | 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; | 19 _callback = callback; |
| 20 _expectJson = expectJson; | 20 _expectJson = expectJson; |
| 21 } | 21 } |
| 22 | 22 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 http.StreamedResponse stringResponse( | 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { | 49 core.int status, core.Map headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); | 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } | 52 } |
| 53 | 53 |
| 54 buildUnnamed1587() { | 54 buildUnnamed649() { |
| 55 var o = new core.List<core.String>(); | 55 var o = new core.List<core.String>(); |
| 56 o.add("foo"); | 56 o.add("foo"); |
| 57 o.add("foo"); | 57 o.add("foo"); |
| 58 return o; | 58 return o; |
| 59 } | 59 } |
| 60 | 60 |
| 61 checkUnnamed1587(core.List<core.String> o) { | 61 checkUnnamed649(core.List<core.String> o) { |
| 62 unittest.expect(o, unittest.hasLength(2)); | 62 unittest.expect(o, unittest.hasLength(2)); |
| 63 unittest.expect(o[0], unittest.equals('foo')); | 63 unittest.expect(o[0], unittest.equals('foo')); |
| 64 unittest.expect(o[1], unittest.equals('foo')); | 64 unittest.expect(o[1], unittest.equals('foo')); |
| 65 } | 65 } |
| 66 | 66 |
| 67 core.int buildCounterCluster = 0; | 67 core.int buildCounterCluster = 0; |
| 68 buildCluster() { | 68 buildCluster() { |
| 69 var o = new api.Cluster(); | 69 var o = new api.Cluster(); |
| 70 buildCounterCluster++; | 70 buildCounterCluster++; |
| 71 if (buildCounterCluster < 3) { | 71 if (buildCounterCluster < 3) { |
| 72 o.clusterApiVersion = "foo"; | 72 o.clusterIpv4Cidr = "foo"; |
| 73 o.containerIpv4Cidr = "foo"; | 73 o.createTime = "foo"; |
| 74 o.creationTimestamp = "foo"; | 74 o.currentMasterVersion = "foo"; |
| 75 o.currentNodeVersion = "foo"; |
| 75 o.description = "foo"; | 76 o.description = "foo"; |
| 76 o.enableCloudLogging = true; | |
| 77 o.enableCloudMonitoring = true; | |
| 78 o.endpoint = "foo"; | 77 o.endpoint = "foo"; |
| 79 o.instanceGroupUrls = buildUnnamed1587(); | 78 o.initialClusterVersion = "foo"; |
| 79 o.initialNodeCount = 42; |
| 80 o.instanceGroupUrls = buildUnnamed649(); |
| 81 o.loggingService = "foo"; |
| 80 o.masterAuth = buildMasterAuth(); | 82 o.masterAuth = buildMasterAuth(); |
| 83 o.monitoringService = "foo"; |
| 81 o.name = "foo"; | 84 o.name = "foo"; |
| 82 o.network = "foo"; | 85 o.network = "foo"; |
| 83 o.nodeConfig = buildNodeConfig(); | 86 o.nodeConfig = buildNodeConfig(); |
| 84 o.nodeRoutingPrefixSize = 42; | 87 o.nodeIpv4CidrSize = 42; |
| 85 o.numNodes = 42; | |
| 86 o.selfLink = "foo"; | 88 o.selfLink = "foo"; |
| 87 o.servicesIpv4Cidr = "foo"; | 89 o.servicesIpv4Cidr = "foo"; |
| 88 o.status = "foo"; | 90 o.status = "foo"; |
| 89 o.statusMessage = "foo"; | 91 o.statusMessage = "foo"; |
| 90 o.zone = "foo"; | 92 o.zone = "foo"; |
| 91 } | 93 } |
| 92 buildCounterCluster--; | 94 buildCounterCluster--; |
| 93 return o; | 95 return o; |
| 94 } | 96 } |
| 95 | 97 |
| 96 checkCluster(api.Cluster o) { | 98 checkCluster(api.Cluster o) { |
| 97 buildCounterCluster++; | 99 buildCounterCluster++; |
| 98 if (buildCounterCluster < 3) { | 100 if (buildCounterCluster < 3) { |
| 99 unittest.expect(o.clusterApiVersion, unittest.equals('foo')); | 101 unittest.expect(o.clusterIpv4Cidr, unittest.equals('foo')); |
| 100 unittest.expect(o.containerIpv4Cidr, unittest.equals('foo')); | 102 unittest.expect(o.createTime, unittest.equals('foo')); |
| 101 unittest.expect(o.creationTimestamp, unittest.equals('foo')); | 103 unittest.expect(o.currentMasterVersion, unittest.equals('foo')); |
| 104 unittest.expect(o.currentNodeVersion, unittest.equals('foo')); |
| 102 unittest.expect(o.description, unittest.equals('foo')); | 105 unittest.expect(o.description, unittest.equals('foo')); |
| 103 unittest.expect(o.enableCloudLogging, unittest.isTrue); | |
| 104 unittest.expect(o.enableCloudMonitoring, unittest.isTrue); | |
| 105 unittest.expect(o.endpoint, unittest.equals('foo')); | 106 unittest.expect(o.endpoint, unittest.equals('foo')); |
| 106 checkUnnamed1587(o.instanceGroupUrls); | 107 unittest.expect(o.initialClusterVersion, unittest.equals('foo')); |
| 108 unittest.expect(o.initialNodeCount, unittest.equals(42)); |
| 109 checkUnnamed649(o.instanceGroupUrls); |
| 110 unittest.expect(o.loggingService, unittest.equals('foo')); |
| 107 checkMasterAuth(o.masterAuth); | 111 checkMasterAuth(o.masterAuth); |
| 112 unittest.expect(o.monitoringService, unittest.equals('foo')); |
| 108 unittest.expect(o.name, unittest.equals('foo')); | 113 unittest.expect(o.name, unittest.equals('foo')); |
| 109 unittest.expect(o.network, unittest.equals('foo')); | 114 unittest.expect(o.network, unittest.equals('foo')); |
| 110 checkNodeConfig(o.nodeConfig); | 115 checkNodeConfig(o.nodeConfig); |
| 111 unittest.expect(o.nodeRoutingPrefixSize, unittest.equals(42)); | 116 unittest.expect(o.nodeIpv4CidrSize, unittest.equals(42)); |
| 112 unittest.expect(o.numNodes, unittest.equals(42)); | |
| 113 unittest.expect(o.selfLink, unittest.equals('foo')); | 117 unittest.expect(o.selfLink, unittest.equals('foo')); |
| 114 unittest.expect(o.servicesIpv4Cidr, unittest.equals('foo')); | 118 unittest.expect(o.servicesIpv4Cidr, unittest.equals('foo')); |
| 115 unittest.expect(o.status, unittest.equals('foo')); | 119 unittest.expect(o.status, unittest.equals('foo')); |
| 116 unittest.expect(o.statusMessage, unittest.equals('foo')); | 120 unittest.expect(o.statusMessage, unittest.equals('foo')); |
| 117 unittest.expect(o.zone, unittest.equals('foo')); | 121 unittest.expect(o.zone, unittest.equals('foo')); |
| 118 } | 122 } |
| 119 buildCounterCluster--; | 123 buildCounterCluster--; |
| 120 } | 124 } |
| 121 | 125 |
| 126 core.int buildCounterClusterUpdate = 0; |
| 127 buildClusterUpdate() { |
| 128 var o = new api.ClusterUpdate(); |
| 129 buildCounterClusterUpdate++; |
| 130 if (buildCounterClusterUpdate < 3) { |
| 131 o.desiredNodeVersion = "foo"; |
| 132 } |
| 133 buildCounterClusterUpdate--; |
| 134 return o; |
| 135 } |
| 136 |
| 137 checkClusterUpdate(api.ClusterUpdate o) { |
| 138 buildCounterClusterUpdate++; |
| 139 if (buildCounterClusterUpdate < 3) { |
| 140 unittest.expect(o.desiredNodeVersion, unittest.equals('foo')); |
| 141 } |
| 142 buildCounterClusterUpdate--; |
| 143 } |
| 144 |
| 122 core.int buildCounterCreateClusterRequest = 0; | 145 core.int buildCounterCreateClusterRequest = 0; |
| 123 buildCreateClusterRequest() { | 146 buildCreateClusterRequest() { |
| 124 var o = new api.CreateClusterRequest(); | 147 var o = new api.CreateClusterRequest(); |
| 125 buildCounterCreateClusterRequest++; | 148 buildCounterCreateClusterRequest++; |
| 126 if (buildCounterCreateClusterRequest < 3) { | 149 if (buildCounterCreateClusterRequest < 3) { |
| 127 o.cluster = buildCluster(); | 150 o.cluster = buildCluster(); |
| 128 } | 151 } |
| 129 buildCounterCreateClusterRequest--; | 152 buildCounterCreateClusterRequest--; |
| 130 return o; | 153 return o; |
| 131 } | 154 } |
| 132 | 155 |
| 133 checkCreateClusterRequest(api.CreateClusterRequest o) { | 156 checkCreateClusterRequest(api.CreateClusterRequest o) { |
| 134 buildCounterCreateClusterRequest++; | 157 buildCounterCreateClusterRequest++; |
| 135 if (buildCounterCreateClusterRequest < 3) { | 158 if (buildCounterCreateClusterRequest < 3) { |
| 136 checkCluster(o.cluster); | 159 checkCluster(o.cluster); |
| 137 } | 160 } |
| 138 buildCounterCreateClusterRequest--; | 161 buildCounterCreateClusterRequest--; |
| 139 } | 162 } |
| 140 | 163 |
| 141 buildUnnamed1588() { | 164 buildUnnamed650() { |
| 142 var o = new core.List<api.Cluster>(); | 165 var o = new core.List<api.Cluster>(); |
| 143 o.add(buildCluster()); | 166 o.add(buildCluster()); |
| 144 o.add(buildCluster()); | 167 o.add(buildCluster()); |
| 145 return o; | 168 return o; |
| 146 } | 169 } |
| 147 | 170 |
| 148 checkUnnamed1588(core.List<api.Cluster> o) { | 171 checkUnnamed650(core.List<api.Cluster> o) { |
| 149 unittest.expect(o, unittest.hasLength(2)); | 172 unittest.expect(o, unittest.hasLength(2)); |
| 150 checkCluster(o[0]); | 173 checkCluster(o[0]); |
| 151 checkCluster(o[1]); | 174 checkCluster(o[1]); |
| 152 } | |
| 153 | |
| 154 core.int buildCounterListAggregatedClustersResponse = 0; | |
| 155 buildListAggregatedClustersResponse() { | |
| 156 var o = new api.ListAggregatedClustersResponse(); | |
| 157 buildCounterListAggregatedClustersResponse++; | |
| 158 if (buildCounterListAggregatedClustersResponse < 3) { | |
| 159 o.clusters = buildUnnamed1588(); | |
| 160 } | |
| 161 buildCounterListAggregatedClustersResponse--; | |
| 162 return o; | |
| 163 } | |
| 164 | |
| 165 checkListAggregatedClustersResponse(api.ListAggregatedClustersResponse o) { | |
| 166 buildCounterListAggregatedClustersResponse++; | |
| 167 if (buildCounterListAggregatedClustersResponse < 3) { | |
| 168 checkUnnamed1588(o.clusters); | |
| 169 } | |
| 170 buildCounterListAggregatedClustersResponse--; | |
| 171 } | |
| 172 | |
| 173 buildUnnamed1589() { | |
| 174 var o = new core.List<api.Operation>(); | |
| 175 o.add(buildOperation()); | |
| 176 o.add(buildOperation()); | |
| 177 return o; | |
| 178 } | |
| 179 | |
| 180 checkUnnamed1589(core.List<api.Operation> o) { | |
| 181 unittest.expect(o, unittest.hasLength(2)); | |
| 182 checkOperation(o[0]); | |
| 183 checkOperation(o[1]); | |
| 184 } | |
| 185 | |
| 186 core.int buildCounterListAggregatedOperationsResponse = 0; | |
| 187 buildListAggregatedOperationsResponse() { | |
| 188 var o = new api.ListAggregatedOperationsResponse(); | |
| 189 buildCounterListAggregatedOperationsResponse++; | |
| 190 if (buildCounterListAggregatedOperationsResponse < 3) { | |
| 191 o.operations = buildUnnamed1589(); | |
| 192 } | |
| 193 buildCounterListAggregatedOperationsResponse--; | |
| 194 return o; | |
| 195 } | |
| 196 | |
| 197 checkListAggregatedOperationsResponse(api.ListAggregatedOperationsResponse o) { | |
| 198 buildCounterListAggregatedOperationsResponse++; | |
| 199 if (buildCounterListAggregatedOperationsResponse < 3) { | |
| 200 checkUnnamed1589(o.operations); | |
| 201 } | |
| 202 buildCounterListAggregatedOperationsResponse--; | |
| 203 } | |
| 204 | |
| 205 buildUnnamed1590() { | |
| 206 var o = new core.List<api.Cluster>(); | |
| 207 o.add(buildCluster()); | |
| 208 o.add(buildCluster()); | |
| 209 return o; | |
| 210 } | |
| 211 | |
| 212 checkUnnamed1590(core.List<api.Cluster> o) { | |
| 213 unittest.expect(o, unittest.hasLength(2)); | |
| 214 checkCluster(o[0]); | |
| 215 checkCluster(o[1]); | |
| 216 } | 175 } |
| 217 | 176 |
| 218 core.int buildCounterListClustersResponse = 0; | 177 core.int buildCounterListClustersResponse = 0; |
| 219 buildListClustersResponse() { | 178 buildListClustersResponse() { |
| 220 var o = new api.ListClustersResponse(); | 179 var o = new api.ListClustersResponse(); |
| 221 buildCounterListClustersResponse++; | 180 buildCounterListClustersResponse++; |
| 222 if (buildCounterListClustersResponse < 3) { | 181 if (buildCounterListClustersResponse < 3) { |
| 223 o.clusters = buildUnnamed1590(); | 182 o.clusters = buildUnnamed650(); |
| 224 } | 183 } |
| 225 buildCounterListClustersResponse--; | 184 buildCounterListClustersResponse--; |
| 226 return o; | 185 return o; |
| 227 } | 186 } |
| 228 | 187 |
| 229 checkListClustersResponse(api.ListClustersResponse o) { | 188 checkListClustersResponse(api.ListClustersResponse o) { |
| 230 buildCounterListClustersResponse++; | 189 buildCounterListClustersResponse++; |
| 231 if (buildCounterListClustersResponse < 3) { | 190 if (buildCounterListClustersResponse < 3) { |
| 232 checkUnnamed1590(o.clusters); | 191 checkUnnamed650(o.clusters); |
| 233 } | 192 } |
| 234 buildCounterListClustersResponse--; | 193 buildCounterListClustersResponse--; |
| 235 } | 194 } |
| 236 | 195 |
| 237 buildUnnamed1591() { | 196 buildUnnamed651() { |
| 238 var o = new core.List<api.Operation>(); | 197 var o = new core.List<api.Operation>(); |
| 239 o.add(buildOperation()); | 198 o.add(buildOperation()); |
| 240 o.add(buildOperation()); | 199 o.add(buildOperation()); |
| 241 return o; | 200 return o; |
| 242 } | 201 } |
| 243 | 202 |
| 244 checkUnnamed1591(core.List<api.Operation> o) { | 203 checkUnnamed651(core.List<api.Operation> o) { |
| 245 unittest.expect(o, unittest.hasLength(2)); | 204 unittest.expect(o, unittest.hasLength(2)); |
| 246 checkOperation(o[0]); | 205 checkOperation(o[0]); |
| 247 checkOperation(o[1]); | 206 checkOperation(o[1]); |
| 248 } | 207 } |
| 249 | 208 |
| 250 core.int buildCounterListOperationsResponse = 0; | 209 core.int buildCounterListOperationsResponse = 0; |
| 251 buildListOperationsResponse() { | 210 buildListOperationsResponse() { |
| 252 var o = new api.ListOperationsResponse(); | 211 var o = new api.ListOperationsResponse(); |
| 253 buildCounterListOperationsResponse++; | 212 buildCounterListOperationsResponse++; |
| 254 if (buildCounterListOperationsResponse < 3) { | 213 if (buildCounterListOperationsResponse < 3) { |
| 255 o.operations = buildUnnamed1591(); | 214 o.operations = buildUnnamed651(); |
| 256 } | 215 } |
| 257 buildCounterListOperationsResponse--; | 216 buildCounterListOperationsResponse--; |
| 258 return o; | 217 return o; |
| 259 } | 218 } |
| 260 | 219 |
| 261 checkListOperationsResponse(api.ListOperationsResponse o) { | 220 checkListOperationsResponse(api.ListOperationsResponse o) { |
| 262 buildCounterListOperationsResponse++; | 221 buildCounterListOperationsResponse++; |
| 263 if (buildCounterListOperationsResponse < 3) { | 222 if (buildCounterListOperationsResponse < 3) { |
| 264 checkUnnamed1591(o.operations); | 223 checkUnnamed651(o.operations); |
| 265 } | 224 } |
| 266 buildCounterListOperationsResponse--; | 225 buildCounterListOperationsResponse--; |
| 267 } | 226 } |
| 268 | 227 |
| 269 core.int buildCounterMasterAuth = 0; | 228 core.int buildCounterMasterAuth = 0; |
| 270 buildMasterAuth() { | 229 buildMasterAuth() { |
| 271 var o = new api.MasterAuth(); | 230 var o = new api.MasterAuth(); |
| 272 buildCounterMasterAuth++; | 231 buildCounterMasterAuth++; |
| 273 if (buildCounterMasterAuth < 3) { | 232 if (buildCounterMasterAuth < 3) { |
| 274 o.bearerToken = "foo"; | |
| 275 o.clientCertificate = "foo"; | 233 o.clientCertificate = "foo"; |
| 276 o.clientKey = "foo"; | 234 o.clientKey = "foo"; |
| 277 o.clusterCaCertificate = "foo"; | 235 o.clusterCaCertificate = "foo"; |
| 278 o.password = "foo"; | 236 o.password = "foo"; |
| 279 o.user = "foo"; | 237 o.username = "foo"; |
| 280 } | 238 } |
| 281 buildCounterMasterAuth--; | 239 buildCounterMasterAuth--; |
| 282 return o; | 240 return o; |
| 283 } | 241 } |
| 284 | 242 |
| 285 checkMasterAuth(api.MasterAuth o) { | 243 checkMasterAuth(api.MasterAuth o) { |
| 286 buildCounterMasterAuth++; | 244 buildCounterMasterAuth++; |
| 287 if (buildCounterMasterAuth < 3) { | 245 if (buildCounterMasterAuth < 3) { |
| 288 unittest.expect(o.bearerToken, unittest.equals('foo')); | |
| 289 unittest.expect(o.clientCertificate, unittest.equals('foo')); | 246 unittest.expect(o.clientCertificate, unittest.equals('foo')); |
| 290 unittest.expect(o.clientKey, unittest.equals('foo')); | 247 unittest.expect(o.clientKey, unittest.equals('foo')); |
| 291 unittest.expect(o.clusterCaCertificate, unittest.equals('foo')); | 248 unittest.expect(o.clusterCaCertificate, unittest.equals('foo')); |
| 292 unittest.expect(o.password, unittest.equals('foo')); | 249 unittest.expect(o.password, unittest.equals('foo')); |
| 293 unittest.expect(o.user, unittest.equals('foo')); | 250 unittest.expect(o.username, unittest.equals('foo')); |
| 294 } | 251 } |
| 295 buildCounterMasterAuth--; | 252 buildCounterMasterAuth--; |
| 296 } | 253 } |
| 297 | 254 |
| 298 buildUnnamed1592() { | 255 buildUnnamed652() { |
| 299 var o = new core.List<api.ServiceAccount>(); | 256 var o = new core.List<core.String>(); |
| 300 o.add(buildServiceAccount()); | 257 o.add("foo"); |
| 301 o.add(buildServiceAccount()); | 258 o.add("foo"); |
| 302 return o; | 259 return o; |
| 303 } | 260 } |
| 304 | 261 |
| 305 checkUnnamed1592(core.List<api.ServiceAccount> o) { | 262 checkUnnamed652(core.List<core.String> o) { |
| 306 unittest.expect(o, unittest.hasLength(2)); | 263 unittest.expect(o, unittest.hasLength(2)); |
| 307 checkServiceAccount(o[0]); | 264 unittest.expect(o[0], unittest.equals('foo')); |
| 308 checkServiceAccount(o[1]); | 265 unittest.expect(o[1], unittest.equals('foo')); |
| 309 } | 266 } |
| 310 | 267 |
| 311 core.int buildCounterNodeConfig = 0; | 268 core.int buildCounterNodeConfig = 0; |
| 312 buildNodeConfig() { | 269 buildNodeConfig() { |
| 313 var o = new api.NodeConfig(); | 270 var o = new api.NodeConfig(); |
| 314 buildCounterNodeConfig++; | 271 buildCounterNodeConfig++; |
| 315 if (buildCounterNodeConfig < 3) { | 272 if (buildCounterNodeConfig < 3) { |
| 273 o.diskSizeGb = 42; |
| 316 o.machineType = "foo"; | 274 o.machineType = "foo"; |
| 317 o.serviceAccounts = buildUnnamed1592(); | 275 o.oauthScopes = buildUnnamed652(); |
| 318 o.sourceImage = "foo"; | |
| 319 } | 276 } |
| 320 buildCounterNodeConfig--; | 277 buildCounterNodeConfig--; |
| 321 return o; | 278 return o; |
| 322 } | 279 } |
| 323 | 280 |
| 324 checkNodeConfig(api.NodeConfig o) { | 281 checkNodeConfig(api.NodeConfig o) { |
| 325 buildCounterNodeConfig++; | 282 buildCounterNodeConfig++; |
| 326 if (buildCounterNodeConfig < 3) { | 283 if (buildCounterNodeConfig < 3) { |
| 284 unittest.expect(o.diskSizeGb, unittest.equals(42)); |
| 327 unittest.expect(o.machineType, unittest.equals('foo')); | 285 unittest.expect(o.machineType, unittest.equals('foo')); |
| 328 checkUnnamed1592(o.serviceAccounts); | 286 checkUnnamed652(o.oauthScopes); |
| 329 unittest.expect(o.sourceImage, unittest.equals('foo')); | |
| 330 } | 287 } |
| 331 buildCounterNodeConfig--; | 288 buildCounterNodeConfig--; |
| 332 } | 289 } |
| 333 | 290 |
| 334 core.int buildCounterOperation = 0; | 291 core.int buildCounterOperation = 0; |
| 335 buildOperation() { | 292 buildOperation() { |
| 336 var o = new api.Operation(); | 293 var o = new api.Operation(); |
| 337 buildCounterOperation++; | 294 buildCounterOperation++; |
| 338 if (buildCounterOperation < 3) { | 295 if (buildCounterOperation < 3) { |
| 339 o.errorMessage = "foo"; | |
| 340 o.name = "foo"; | 296 o.name = "foo"; |
| 341 o.operationType = "foo"; | 297 o.operationType = "foo"; |
| 342 o.selfLink = "foo"; | 298 o.selfLink = "foo"; |
| 343 o.status = "foo"; | 299 o.status = "foo"; |
| 344 o.target = "foo"; | 300 o.statusMessage = "foo"; |
| 345 o.targetLink = "foo"; | 301 o.targetLink = "foo"; |
| 346 o.zone = "foo"; | 302 o.zone = "foo"; |
| 347 } | 303 } |
| 348 buildCounterOperation--; | 304 buildCounterOperation--; |
| 349 return o; | 305 return o; |
| 350 } | 306 } |
| 351 | 307 |
| 352 checkOperation(api.Operation o) { | 308 checkOperation(api.Operation o) { |
| 353 buildCounterOperation++; | 309 buildCounterOperation++; |
| 354 if (buildCounterOperation < 3) { | 310 if (buildCounterOperation < 3) { |
| 355 unittest.expect(o.errorMessage, unittest.equals('foo')); | |
| 356 unittest.expect(o.name, unittest.equals('foo')); | 311 unittest.expect(o.name, unittest.equals('foo')); |
| 357 unittest.expect(o.operationType, unittest.equals('foo')); | 312 unittest.expect(o.operationType, unittest.equals('foo')); |
| 358 unittest.expect(o.selfLink, unittest.equals('foo')); | 313 unittest.expect(o.selfLink, unittest.equals('foo')); |
| 359 unittest.expect(o.status, unittest.equals('foo')); | 314 unittest.expect(o.status, unittest.equals('foo')); |
| 360 unittest.expect(o.target, unittest.equals('foo')); | 315 unittest.expect(o.statusMessage, unittest.equals('foo')); |
| 361 unittest.expect(o.targetLink, unittest.equals('foo')); | 316 unittest.expect(o.targetLink, unittest.equals('foo')); |
| 362 unittest.expect(o.zone, unittest.equals('foo')); | 317 unittest.expect(o.zone, unittest.equals('foo')); |
| 363 } | 318 } |
| 364 buildCounterOperation--; | 319 buildCounterOperation--; |
| 365 } | 320 } |
| 366 | 321 |
| 367 buildUnnamed1593() { | 322 core.int buildCounterUpdateClusterRequest = 0; |
| 368 var o = new core.List<core.String>(); | 323 buildUpdateClusterRequest() { |
| 369 o.add("foo"); | 324 var o = new api.UpdateClusterRequest(); |
| 370 o.add("foo"); | 325 buildCounterUpdateClusterRequest++; |
| 326 if (buildCounterUpdateClusterRequest < 3) { |
| 327 o.update = buildClusterUpdate(); |
| 328 } |
| 329 buildCounterUpdateClusterRequest--; |
| 371 return o; | 330 return o; |
| 372 } | 331 } |
| 373 | 332 |
| 374 checkUnnamed1593(core.List<core.String> o) { | 333 checkUpdateClusterRequest(api.UpdateClusterRequest o) { |
| 375 unittest.expect(o, unittest.hasLength(2)); | 334 buildCounterUpdateClusterRequest++; |
| 376 unittest.expect(o[0], unittest.equals('foo')); | 335 if (buildCounterUpdateClusterRequest < 3) { |
| 377 unittest.expect(o[1], unittest.equals('foo')); | 336 checkClusterUpdate(o.update); |
| 378 } | |
| 379 | |
| 380 core.int buildCounterServiceAccount = 0; | |
| 381 buildServiceAccount() { | |
| 382 var o = new api.ServiceAccount(); | |
| 383 buildCounterServiceAccount++; | |
| 384 if (buildCounterServiceAccount < 3) { | |
| 385 o.email = "foo"; | |
| 386 o.scopes = buildUnnamed1593(); | |
| 387 } | 337 } |
| 388 buildCounterServiceAccount--; | 338 buildCounterUpdateClusterRequest--; |
| 389 return o; | |
| 390 } | |
| 391 | |
| 392 checkServiceAccount(api.ServiceAccount o) { | |
| 393 buildCounterServiceAccount++; | |
| 394 if (buildCounterServiceAccount < 3) { | |
| 395 unittest.expect(o.email, unittest.equals('foo')); | |
| 396 checkUnnamed1593(o.scopes); | |
| 397 } | |
| 398 buildCounterServiceAccount--; | |
| 399 } | 339 } |
| 400 | 340 |
| 401 | 341 |
| 402 main() { | 342 main() { |
| 403 unittest.group("obj-schema-Cluster", () { | 343 unittest.group("obj-schema-Cluster", () { |
| 404 unittest.test("to-json--from-json", () { | 344 unittest.test("to-json--from-json", () { |
| 405 var o = buildCluster(); | 345 var o = buildCluster(); |
| 406 var od = new api.Cluster.fromJson(o.toJson()); | 346 var od = new api.Cluster.fromJson(o.toJson()); |
| 407 checkCluster(od); | 347 checkCluster(od); |
| 408 }); | 348 }); |
| 409 }); | 349 }); |
| 410 | 350 |
| 411 | 351 |
| 352 unittest.group("obj-schema-ClusterUpdate", () { |
| 353 unittest.test("to-json--from-json", () { |
| 354 var o = buildClusterUpdate(); |
| 355 var od = new api.ClusterUpdate.fromJson(o.toJson()); |
| 356 checkClusterUpdate(od); |
| 357 }); |
| 358 }); |
| 359 |
| 360 |
| 412 unittest.group("obj-schema-CreateClusterRequest", () { | 361 unittest.group("obj-schema-CreateClusterRequest", () { |
| 413 unittest.test("to-json--from-json", () { | 362 unittest.test("to-json--from-json", () { |
| 414 var o = buildCreateClusterRequest(); | 363 var o = buildCreateClusterRequest(); |
| 415 var od = new api.CreateClusterRequest.fromJson(o.toJson()); | 364 var od = new api.CreateClusterRequest.fromJson(o.toJson()); |
| 416 checkCreateClusterRequest(od); | 365 checkCreateClusterRequest(od); |
| 417 }); | 366 }); |
| 418 }); | 367 }); |
| 419 | 368 |
| 420 | |
| 421 unittest.group("obj-schema-ListAggregatedClustersResponse", () { | |
| 422 unittest.test("to-json--from-json", () { | |
| 423 var o = buildListAggregatedClustersResponse(); | |
| 424 var od = new api.ListAggregatedClustersResponse.fromJson(o.toJson()); | |
| 425 checkListAggregatedClustersResponse(od); | |
| 426 }); | |
| 427 }); | |
| 428 | |
| 429 | |
| 430 unittest.group("obj-schema-ListAggregatedOperationsResponse", () { | |
| 431 unittest.test("to-json--from-json", () { | |
| 432 var o = buildListAggregatedOperationsResponse(); | |
| 433 var od = new api.ListAggregatedOperationsResponse.fromJson(o.toJson()); | |
| 434 checkListAggregatedOperationsResponse(od); | |
| 435 }); | |
| 436 }); | |
| 437 | |
| 438 | 369 |
| 439 unittest.group("obj-schema-ListClustersResponse", () { | 370 unittest.group("obj-schema-ListClustersResponse", () { |
| 440 unittest.test("to-json--from-json", () { | 371 unittest.test("to-json--from-json", () { |
| 441 var o = buildListClustersResponse(); | 372 var o = buildListClustersResponse(); |
| 442 var od = new api.ListClustersResponse.fromJson(o.toJson()); | 373 var od = new api.ListClustersResponse.fromJson(o.toJson()); |
| 443 checkListClustersResponse(od); | 374 checkListClustersResponse(od); |
| 444 }); | 375 }); |
| 445 }); | 376 }); |
| 446 | 377 |
| 447 | 378 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 474 | 405 |
| 475 unittest.group("obj-schema-Operation", () { | 406 unittest.group("obj-schema-Operation", () { |
| 476 unittest.test("to-json--from-json", () { | 407 unittest.test("to-json--from-json", () { |
| 477 var o = buildOperation(); | 408 var o = buildOperation(); |
| 478 var od = new api.Operation.fromJson(o.toJson()); | 409 var od = new api.Operation.fromJson(o.toJson()); |
| 479 checkOperation(od); | 410 checkOperation(od); |
| 480 }); | 411 }); |
| 481 }); | 412 }); |
| 482 | 413 |
| 483 | 414 |
| 484 unittest.group("obj-schema-ServiceAccount", () { | 415 unittest.group("obj-schema-UpdateClusterRequest", () { |
| 485 unittest.test("to-json--from-json", () { | 416 unittest.test("to-json--from-json", () { |
| 486 var o = buildServiceAccount(); | 417 var o = buildUpdateClusterRequest(); |
| 487 var od = new api.ServiceAccount.fromJson(o.toJson()); | 418 var od = new api.UpdateClusterRequest.fromJson(o.toJson()); |
| 488 checkServiceAccount(od); | 419 checkUpdateClusterRequest(od); |
| 489 }); | 420 }); |
| 490 }); | 421 }); |
| 491 | 422 |
| 492 | 423 |
| 493 unittest.group("resource-ProjectsClustersResourceApi", () { | 424 unittest.group("resource-ProjectsZonesClustersResourceApi", () { |
| 494 unittest.test("method--list", () { | 425 unittest.test("method--create", () { |
| 495 | 426 |
| 496 var mock = new HttpServerMock(); | 427 var mock = new HttpServerMock(); |
| 497 api.ProjectsClustersResourceApi res = new api.ContainerApi(mock).projects.
clusters; | 428 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; |
| 429 var arg_request = buildCreateClusterRequest(); |
| 498 var arg_projectId = "foo"; | 430 var arg_projectId = "foo"; |
| 431 var arg_zone = "foo"; |
| 499 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 432 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 433 var obj = new api.CreateClusterRequest.fromJson(json); |
| 434 checkCreateClusterRequest(obj); |
| 435 |
| 500 var path = (req.url).path; | 436 var path = (req.url).path; |
| 501 var pathOffset = 0; | 437 var pathOffset = 0; |
| 502 var index; | 438 var index; |
| 503 var subPart; | 439 var subPart; |
| 504 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 440 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 505 pathOffset += 1; | 441 pathOffset += 1; |
| 442 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/projects/")); |
| 443 pathOffset += 12; |
| 444 index = path.indexOf("/zones/", pathOffset); |
| 445 unittest.expect(index >= 0, unittest.isTrue); |
| 446 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 447 pathOffset = index; |
| 448 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| 449 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/zones/")); |
| 450 pathOffset += 7; |
| 451 index = path.indexOf("/clusters", pathOffset); |
| 452 unittest.expect(index >= 0, unittest.isTrue); |
| 453 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 454 pathOffset = index; |
| 455 unittest.expect(subPart, unittest.equals("$arg_zone")); |
| 456 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/clusters")); |
| 457 pathOffset += 9; |
| 506 | 458 |
| 507 var query = (req.url).query; | 459 var query = (req.url).query; |
| 508 var queryOffset = 0; | 460 var queryOffset = 0; |
| 509 var queryMap = {}; | |
| 510 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 511 parseBool(n) { | |
| 512 if (n == "true") return true; | |
| 513 if (n == "false") return false; | |
| 514 if (n == null) return null; | |
| 515 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 516 } | |
| 517 if (query.length > 0) { | |
| 518 for (var part in query.split("&")) { | |
| 519 var keyvalue = part.split("="); | |
| 520 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 521 } | |
| 522 } | |
| 523 | |
| 524 | |
| 525 var h = { | |
| 526 "content-type" : "application/json; charset=utf-8", | |
| 527 }; | |
| 528 var resp = convert.JSON.encode(buildListAggregatedClustersResponse()); | |
| 529 return new async.Future.value(stringResponse(200, h, resp)); | |
| 530 }), true); | |
| 531 res.list(arg_projectId).then(unittest.expectAsync(((api.ListAggregatedClus
tersResponse response) { | |
| 532 checkListAggregatedClustersResponse(response); | |
| 533 }))); | |
| 534 }); | |
| 535 | |
| 536 }); | |
| 537 | |
| 538 | |
| 539 unittest.group("resource-ProjectsOperationsResourceApi", () { | |
| 540 unittest.test("method--list", () { | |
| 541 | |
| 542 var mock = new HttpServerMock(); | |
| 543 api.ProjectsOperationsResourceApi res = new api.ContainerApi(mock).project
s.operations; | |
| 544 var arg_projectId = "foo"; | |
| 545 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 546 var path = (req.url).path; | |
| 547 var pathOffset = 0; | |
| 548 var index; | |
| 549 var subPart; | |
| 550 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
| 551 pathOffset += 1; | |
| 552 | |
| 553 var query = (req.url).query; | |
| 554 var queryOffset = 0; | |
| 555 var queryMap = {}; | 461 var queryMap = {}; |
| 556 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 462 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 557 parseBool(n) { | 463 parseBool(n) { |
| 558 if (n == "true") return true; | 464 if (n == "true") return true; |
| 559 if (n == "false") return false; | 465 if (n == "false") return false; |
| 560 if (n == null) return null; | 466 if (n == null) return null; |
| 561 throw new core.ArgumentError("Invalid boolean: $n"); | 467 throw new core.ArgumentError("Invalid boolean: $n"); |
| 562 } | 468 } |
| 563 if (query.length > 0) { | 469 if (query.length > 0) { |
| 564 for (var part in query.split("&")) { | 470 for (var part in query.split("&")) { |
| 565 var keyvalue = part.split("="); | 471 var keyvalue = part.split("="); |
| 566 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 472 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 567 } | 473 } |
| 568 } | 474 } |
| 569 | 475 |
| 570 | 476 |
| 571 var h = { | 477 var h = { |
| 572 "content-type" : "application/json; charset=utf-8", | 478 "content-type" : "application/json; charset=utf-8", |
| 573 }; | 479 }; |
| 574 var resp = convert.JSON.encode(buildListAggregatedOperationsResponse()); | 480 var resp = convert.JSON.encode(buildOperation()); |
| 575 return new async.Future.value(stringResponse(200, h, resp)); | 481 return new async.Future.value(stringResponse(200, h, resp)); |
| 576 }), true); | 482 }), true); |
| 577 res.list(arg_projectId).then(unittest.expectAsync(((api.ListAggregatedOper
ationsResponse response) { | 483 res.create(arg_request, arg_projectId, arg_zone).then(unittest.expectAsync
(((api.Operation response) { |
| 578 checkListAggregatedOperationsResponse(response); | 484 checkOperation(response); |
| 579 }))); | 485 }))); |
| 580 }); | 486 }); |
| 581 | 487 |
| 582 }); | 488 unittest.test("method--delete", () { |
| 583 | |
| 584 | |
| 585 unittest.group("resource-ProjectsZonesClustersResourceApi", () { | |
| 586 unittest.test("method--create", () { | |
| 587 | 489 |
| 588 var mock = new HttpServerMock(); | 490 var mock = new HttpServerMock(); |
| 589 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; | 491 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; |
| 590 var arg_request = buildCreateClusterRequest(); | |
| 591 var arg_projectId = "foo"; | 492 var arg_projectId = "foo"; |
| 592 var arg_zoneId = "foo"; | 493 var arg_zone = "foo"; |
| 494 var arg_clusterId = "foo"; |
| 593 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 495 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 594 var obj = new api.CreateClusterRequest.fromJson(json); | |
| 595 checkCreateClusterRequest(obj); | |
| 596 | |
| 597 var path = (req.url).path; | 496 var path = (req.url).path; |
| 598 var pathOffset = 0; | 497 var pathOffset = 0; |
| 599 var index; | 498 var index; |
| 600 var subPart; | 499 var subPart; |
| 601 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 500 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 602 pathOffset += 1; | 501 pathOffset += 1; |
| 502 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/projects/")); |
| 503 pathOffset += 12; |
| 504 index = path.indexOf("/zones/", pathOffset); |
| 505 unittest.expect(index >= 0, unittest.isTrue); |
| 506 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 507 pathOffset = index; |
| 508 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| 509 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/zones/")); |
| 510 pathOffset += 7; |
| 511 index = path.indexOf("/clusters/", pathOffset); |
| 512 unittest.expect(index >= 0, unittest.isTrue); |
| 513 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 514 pathOffset = index; |
| 515 unittest.expect(subPart, unittest.equals("$arg_zone")); |
| 516 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/clusters/")); |
| 517 pathOffset += 10; |
| 518 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 519 pathOffset = path.length; |
| 520 unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| 603 | 521 |
| 604 var query = (req.url).query; | 522 var query = (req.url).query; |
| 605 var queryOffset = 0; | 523 var queryOffset = 0; |
| 606 var queryMap = {}; | 524 var queryMap = {}; |
| 607 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 525 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 608 parseBool(n) { | 526 parseBool(n) { |
| 609 if (n == "true") return true; | 527 if (n == "true") return true; |
| 610 if (n == "false") return false; | 528 if (n == "false") return false; |
| 611 if (n == null) return null; | 529 if (n == null) return null; |
| 612 throw new core.ArgumentError("Invalid boolean: $n"); | 530 throw new core.ArgumentError("Invalid boolean: $n"); |
| 613 } | 531 } |
| 614 if (query.length > 0) { | 532 if (query.length > 0) { |
| 615 for (var part in query.split("&")) { | 533 for (var part in query.split("&")) { |
| 616 var keyvalue = part.split("="); | 534 var keyvalue = part.split("="); |
| 617 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 535 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 618 } | 536 } |
| 619 } | 537 } |
| 620 | 538 |
| 621 | 539 |
| 622 var h = { | 540 var h = { |
| 623 "content-type" : "application/json; charset=utf-8", | 541 "content-type" : "application/json; charset=utf-8", |
| 624 }; | 542 }; |
| 625 var resp = convert.JSON.encode(buildOperation()); | 543 var resp = convert.JSON.encode(buildOperation()); |
| 626 return new async.Future.value(stringResponse(200, h, resp)); | 544 return new async.Future.value(stringResponse(200, h, resp)); |
| 627 }), true); | 545 }), true); |
| 628 res.create(arg_request, arg_projectId, arg_zoneId).then(unittest.expectAsy
nc(((api.Operation response) { | 546 res.delete(arg_projectId, arg_zone, arg_clusterId).then(unittest.expectAsy
nc(((api.Operation response) { |
| 629 checkOperation(response); | 547 checkOperation(response); |
| 630 }))); | 548 }))); |
| 631 }); | 549 }); |
| 632 | 550 |
| 633 unittest.test("method--delete", () { | 551 unittest.test("method--get", () { |
| 634 | 552 |
| 635 var mock = new HttpServerMock(); | 553 var mock = new HttpServerMock(); |
| 636 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; | 554 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; |
| 637 var arg_projectId = "foo"; | 555 var arg_projectId = "foo"; |
| 638 var arg_zoneId = "foo"; | 556 var arg_zone = "foo"; |
| 639 var arg_clusterId = "foo"; | 557 var arg_clusterId = "foo"; |
| 640 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 558 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 641 var path = (req.url).path; | 559 var path = (req.url).path; |
| 642 var pathOffset = 0; | 560 var pathOffset = 0; |
| 643 var index; | 561 var index; |
| 644 var subPart; | 562 var subPart; |
| 645 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 563 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 646 pathOffset += 1; | 564 pathOffset += 1; |
| 565 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/projects/")); |
| 566 pathOffset += 12; |
| 567 index = path.indexOf("/zones/", pathOffset); |
| 568 unittest.expect(index >= 0, unittest.isTrue); |
| 569 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 570 pathOffset = index; |
| 571 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| 572 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/zones/")); |
| 573 pathOffset += 7; |
| 574 index = path.indexOf("/clusters/", pathOffset); |
| 575 unittest.expect(index >= 0, unittest.isTrue); |
| 576 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 577 pathOffset = index; |
| 578 unittest.expect(subPart, unittest.equals("$arg_zone")); |
| 579 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/clusters/")); |
| 580 pathOffset += 10; |
| 581 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 582 pathOffset = path.length; |
| 583 unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| 647 | 584 |
| 648 var query = (req.url).query; | 585 var query = (req.url).query; |
| 649 var queryOffset = 0; | 586 var queryOffset = 0; |
| 650 var queryMap = {}; | 587 var queryMap = {}; |
| 651 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 588 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 652 parseBool(n) { | 589 parseBool(n) { |
| 653 if (n == "true") return true; | 590 if (n == "true") return true; |
| 654 if (n == "false") return false; | 591 if (n == "false") return false; |
| 655 if (n == null) return null; | 592 if (n == null) return null; |
| 656 throw new core.ArgumentError("Invalid boolean: $n"); | 593 throw new core.ArgumentError("Invalid boolean: $n"); |
| 657 } | 594 } |
| 658 if (query.length > 0) { | 595 if (query.length > 0) { |
| 659 for (var part in query.split("&")) { | 596 for (var part in query.split("&")) { |
| 660 var keyvalue = part.split("="); | 597 var keyvalue = part.split("="); |
| 661 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 598 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 662 } | 599 } |
| 663 } | 600 } |
| 664 | 601 |
| 665 | 602 |
| 666 var h = { | 603 var h = { |
| 667 "content-type" : "application/json; charset=utf-8", | 604 "content-type" : "application/json; charset=utf-8", |
| 668 }; | 605 }; |
| 669 var resp = convert.JSON.encode(buildOperation()); | 606 var resp = convert.JSON.encode(buildCluster()); |
| 670 return new async.Future.value(stringResponse(200, h, resp)); | 607 return new async.Future.value(stringResponse(200, h, resp)); |
| 671 }), true); | 608 }), true); |
| 672 res.delete(arg_projectId, arg_zoneId, arg_clusterId).then(unittest.expectA
sync(((api.Operation response) { | 609 res.get(arg_projectId, arg_zone, arg_clusterId).then(unittest.expectAsync(
((api.Cluster response) { |
| 673 checkOperation(response); | 610 checkCluster(response); |
| 674 }))); | 611 }))); |
| 675 }); | 612 }); |
| 676 | 613 |
| 677 unittest.test("method--get", () { | 614 unittest.test("method--list", () { |
| 678 | 615 |
| 679 var mock = new HttpServerMock(); | 616 var mock = new HttpServerMock(); |
| 680 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; | 617 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; |
| 681 var arg_projectId = "foo"; | 618 var arg_projectId = "foo"; |
| 682 var arg_zoneId = "foo"; | 619 var arg_zone = "foo"; |
| 683 var arg_clusterId = "foo"; | |
| 684 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 620 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 685 var path = (req.url).path; | 621 var path = (req.url).path; |
| 686 var pathOffset = 0; | 622 var pathOffset = 0; |
| 687 var index; | 623 var index; |
| 688 var subPart; | 624 var subPart; |
| 689 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 625 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 690 pathOffset += 1; | 626 pathOffset += 1; |
| 627 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/projects/")); |
| 628 pathOffset += 12; |
| 629 index = path.indexOf("/zones/", pathOffset); |
| 630 unittest.expect(index >= 0, unittest.isTrue); |
| 631 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 632 pathOffset = index; |
| 633 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| 634 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/zones/")); |
| 635 pathOffset += 7; |
| 636 index = path.indexOf("/clusters", pathOffset); |
| 637 unittest.expect(index >= 0, unittest.isTrue); |
| 638 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 639 pathOffset = index; |
| 640 unittest.expect(subPart, unittest.equals("$arg_zone")); |
| 641 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/clusters")); |
| 642 pathOffset += 9; |
| 691 | 643 |
| 692 var query = (req.url).query; | 644 var query = (req.url).query; |
| 693 var queryOffset = 0; | 645 var queryOffset = 0; |
| 694 var queryMap = {}; | 646 var queryMap = {}; |
| 695 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 647 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 696 parseBool(n) { | 648 parseBool(n) { |
| 697 if (n == "true") return true; | 649 if (n == "true") return true; |
| 698 if (n == "false") return false; | 650 if (n == "false") return false; |
| 699 if (n == null) return null; | 651 if (n == null) return null; |
| 700 throw new core.ArgumentError("Invalid boolean: $n"); | 652 throw new core.ArgumentError("Invalid boolean: $n"); |
| 701 } | 653 } |
| 702 if (query.length > 0) { | 654 if (query.length > 0) { |
| 703 for (var part in query.split("&")) { | 655 for (var part in query.split("&")) { |
| 704 var keyvalue = part.split("="); | 656 var keyvalue = part.split("="); |
| 705 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 657 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 706 } | 658 } |
| 707 } | 659 } |
| 708 | 660 |
| 709 | 661 |
| 710 var h = { | 662 var h = { |
| 711 "content-type" : "application/json; charset=utf-8", | 663 "content-type" : "application/json; charset=utf-8", |
| 712 }; | 664 }; |
| 713 var resp = convert.JSON.encode(buildCluster()); | 665 var resp = convert.JSON.encode(buildListClustersResponse()); |
| 714 return new async.Future.value(stringResponse(200, h, resp)); | 666 return new async.Future.value(stringResponse(200, h, resp)); |
| 715 }), true); | 667 }), true); |
| 716 res.get(arg_projectId, arg_zoneId, arg_clusterId).then(unittest.expectAsyn
c(((api.Cluster response) { | 668 res.list(arg_projectId, arg_zone).then(unittest.expectAsync(((api.ListClus
tersResponse response) { |
| 717 checkCluster(response); | 669 checkListClustersResponse(response); |
| 718 }))); | 670 }))); |
| 719 }); | 671 }); |
| 720 | 672 |
| 721 unittest.test("method--list", () { | 673 unittest.test("method--update", () { |
| 722 | 674 |
| 723 var mock = new HttpServerMock(); | 675 var mock = new HttpServerMock(); |
| 724 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; | 676 api.ProjectsZonesClustersResourceApi res = new api.ContainerApi(mock).proj
ects.zones.clusters; |
| 677 var arg_request = buildUpdateClusterRequest(); |
| 725 var arg_projectId = "foo"; | 678 var arg_projectId = "foo"; |
| 726 var arg_zoneId = "foo"; | 679 var arg_zone = "foo"; |
| 680 var arg_clusterId = "foo"; |
| 727 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 681 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 682 var obj = new api.UpdateClusterRequest.fromJson(json); |
| 683 checkUpdateClusterRequest(obj); |
| 684 |
| 728 var path = (req.url).path; | 685 var path = (req.url).path; |
| 729 var pathOffset = 0; | 686 var pathOffset = 0; |
| 730 var index; | 687 var index; |
| 731 var subPart; | 688 var subPart; |
| 732 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 689 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 733 pathOffset += 1; | 690 pathOffset += 1; |
| 691 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/projects/")); |
| 692 pathOffset += 12; |
| 693 index = path.indexOf("/zones/", pathOffset); |
| 694 unittest.expect(index >= 0, unittest.isTrue); |
| 695 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 696 pathOffset = index; |
| 697 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| 698 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/zones/")); |
| 699 pathOffset += 7; |
| 700 index = path.indexOf("/clusters/", pathOffset); |
| 701 unittest.expect(index >= 0, unittest.isTrue); |
| 702 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 703 pathOffset = index; |
| 704 unittest.expect(subPart, unittest.equals("$arg_zone")); |
| 705 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/clusters/")); |
| 706 pathOffset += 10; |
| 707 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 708 pathOffset = path.length; |
| 709 unittest.expect(subPart, unittest.equals("$arg_clusterId")); |
| 734 | 710 |
| 735 var query = (req.url).query; | 711 var query = (req.url).query; |
| 736 var queryOffset = 0; | 712 var queryOffset = 0; |
| 737 var queryMap = {}; | 713 var queryMap = {}; |
| 738 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 714 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 739 parseBool(n) { | 715 parseBool(n) { |
| 740 if (n == "true") return true; | 716 if (n == "true") return true; |
| 741 if (n == "false") return false; | 717 if (n == "false") return false; |
| 742 if (n == null) return null; | 718 if (n == null) return null; |
| 743 throw new core.ArgumentError("Invalid boolean: $n"); | 719 throw new core.ArgumentError("Invalid boolean: $n"); |
| 744 } | 720 } |
| 745 if (query.length > 0) { | 721 if (query.length > 0) { |
| 746 for (var part in query.split("&")) { | 722 for (var part in query.split("&")) { |
| 747 var keyvalue = part.split("="); | 723 var keyvalue = part.split("="); |
| 748 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 724 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 749 } | 725 } |
| 750 } | 726 } |
| 751 | 727 |
| 752 | 728 |
| 753 var h = { | 729 var h = { |
| 754 "content-type" : "application/json; charset=utf-8", | 730 "content-type" : "application/json; charset=utf-8", |
| 755 }; | 731 }; |
| 756 var resp = convert.JSON.encode(buildListClustersResponse()); | 732 var resp = convert.JSON.encode(buildOperation()); |
| 757 return new async.Future.value(stringResponse(200, h, resp)); | 733 return new async.Future.value(stringResponse(200, h, resp)); |
| 758 }), true); | 734 }), true); |
| 759 res.list(arg_projectId, arg_zoneId).then(unittest.expectAsync(((api.ListCl
ustersResponse response) { | 735 res.update(arg_request, arg_projectId, arg_zone, arg_clusterId).then(unitt
est.expectAsync(((api.Operation response) { |
| 760 checkListClustersResponse(response); | 736 checkOperation(response); |
| 761 }))); | 737 }))); |
| 762 }); | 738 }); |
| 763 | 739 |
| 764 }); | 740 }); |
| 765 | 741 |
| 766 | 742 |
| 767 unittest.group("resource-ProjectsZonesOperationsResourceApi", () { | 743 unittest.group("resource-ProjectsZonesOperationsResourceApi", () { |
| 768 unittest.test("method--get", () { | 744 unittest.test("method--get", () { |
| 769 | 745 |
| 770 var mock = new HttpServerMock(); | 746 var mock = new HttpServerMock(); |
| 771 api.ProjectsZonesOperationsResourceApi res = new api.ContainerApi(mock).pr
ojects.zones.operations; | 747 api.ProjectsZonesOperationsResourceApi res = new api.ContainerApi(mock).pr
ojects.zones.operations; |
| 772 var arg_projectId = "foo"; | 748 var arg_projectId = "foo"; |
| 773 var arg_zoneId = "foo"; | 749 var arg_zone = "foo"; |
| 774 var arg_operationId = "foo"; | 750 var arg_operationId = "foo"; |
| 775 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 751 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 776 var path = (req.url).path; | 752 var path = (req.url).path; |
| 777 var pathOffset = 0; | 753 var pathOffset = 0; |
| 778 var index; | 754 var index; |
| 779 var subPart; | 755 var subPart; |
| 780 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 756 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 781 pathOffset += 1; | 757 pathOffset += 1; |
| 758 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/projects/")); |
| 759 pathOffset += 12; |
| 760 index = path.indexOf("/zones/", pathOffset); |
| 761 unittest.expect(index >= 0, unittest.isTrue); |
| 762 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 763 pathOffset = index; |
| 764 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| 765 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/zones/")); |
| 766 pathOffset += 7; |
| 767 index = path.indexOf("/operations/", pathOffset); |
| 768 unittest.expect(index >= 0, unittest.isTrue); |
| 769 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 770 pathOffset = index; |
| 771 unittest.expect(subPart, unittest.equals("$arg_zone")); |
| 772 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("/operations/")); |
| 773 pathOffset += 12; |
| 774 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 775 pathOffset = path.length; |
| 776 unittest.expect(subPart, unittest.equals("$arg_operationId")); |
| 782 | 777 |
| 783 var query = (req.url).query; | 778 var query = (req.url).query; |
| 784 var queryOffset = 0; | 779 var queryOffset = 0; |
| 785 var queryMap = {}; | 780 var queryMap = {}; |
| 786 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 781 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 787 parseBool(n) { | 782 parseBool(n) { |
| 788 if (n == "true") return true; | 783 if (n == "true") return true; |
| 789 if (n == "false") return false; | 784 if (n == "false") return false; |
| 790 if (n == null) return null; | 785 if (n == null) return null; |
| 791 throw new core.ArgumentError("Invalid boolean: $n"); | 786 throw new core.ArgumentError("Invalid boolean: $n"); |
| 792 } | 787 } |
| 793 if (query.length > 0) { | 788 if (query.length > 0) { |
| 794 for (var part in query.split("&")) { | 789 for (var part in query.split("&")) { |
| 795 var keyvalue = part.split("="); | 790 var keyvalue = part.split("="); |
| 796 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 791 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 797 } | 792 } |
| 798 } | 793 } |
| 799 | 794 |
| 800 | 795 |
| 801 var h = { | 796 var h = { |
| 802 "content-type" : "application/json; charset=utf-8", | 797 "content-type" : "application/json; charset=utf-8", |
| 803 }; | 798 }; |
| 804 var resp = convert.JSON.encode(buildOperation()); | 799 var resp = convert.JSON.encode(buildOperation()); |
| 805 return new async.Future.value(stringResponse(200, h, resp)); | 800 return new async.Future.value(stringResponse(200, h, resp)); |
| 806 }), true); | 801 }), true); |
| 807 res.get(arg_projectId, arg_zoneId, arg_operationId).then(unittest.expectAs
ync(((api.Operation response) { | 802 res.get(arg_projectId, arg_zone, arg_operationId).then(unittest.expectAsyn
c(((api.Operation response) { |
| 808 checkOperation(response); | 803 checkOperation(response); |
| 809 }))); | 804 }))); |
| 810 }); | 805 }); |
| 811 | 806 |
| 812 unittest.test("method--list", () { | 807 unittest.test("method--list", () { |
| 813 | 808 |
| 814 var mock = new HttpServerMock(); | 809 var mock = new HttpServerMock(); |
| 815 api.ProjectsZonesOperationsResourceApi res = new api.ContainerApi(mock).pr
ojects.zones.operations; | 810 api.ProjectsZonesOperationsResourceApi res = new api.ContainerApi(mock).pr
ojects.zones.operations; |
| 816 var arg_projectId = "foo"; | 811 var arg_projectId = "foo"; |
| 817 var arg_zoneId = "foo"; | 812 var arg_zone = "foo"; |
| 818 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 813 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 819 var path = (req.url).path; | 814 var path = (req.url).path; |
| 820 var pathOffset = 0; | 815 var pathOffset = 0; |
| 821 var index; | 816 var index; |
| 822 var subPart; | 817 var subPart; |
| 823 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 818 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 824 pathOffset += 1; | 819 pathOffset += 1; |
| 820 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/projects/")); |
| 821 pathOffset += 12; |
| 822 index = path.indexOf("/zones/", pathOffset); |
| 823 unittest.expect(index >= 0, unittest.isTrue); |
| 824 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 825 pathOffset = index; |
| 826 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
| 827 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/zones/")); |
| 828 pathOffset += 7; |
| 829 index = path.indexOf("/operations", pathOffset); |
| 830 unittest.expect(index >= 0, unittest.isTrue); |
| 831 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); |
| 832 pathOffset = index; |
| 833 unittest.expect(subPart, unittest.equals("$arg_zone")); |
| 834 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("/operations")); |
| 835 pathOffset += 11; |
| 825 | 836 |
| 826 var query = (req.url).query; | 837 var query = (req.url).query; |
| 827 var queryOffset = 0; | 838 var queryOffset = 0; |
| 828 var queryMap = {}; | 839 var queryMap = {}; |
| 829 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 840 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 830 parseBool(n) { | 841 parseBool(n) { |
| 831 if (n == "true") return true; | 842 if (n == "true") return true; |
| 832 if (n == "false") return false; | 843 if (n == "false") return false; |
| 833 if (n == null) return null; | 844 if (n == null) return null; |
| 834 throw new core.ArgumentError("Invalid boolean: $n"); | 845 throw new core.ArgumentError("Invalid boolean: $n"); |
| 835 } | 846 } |
| 836 if (query.length > 0) { | 847 if (query.length > 0) { |
| 837 for (var part in query.split("&")) { | 848 for (var part in query.split("&")) { |
| 838 var keyvalue = part.split("="); | 849 var keyvalue = part.split("="); |
| 839 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 850 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 840 } | 851 } |
| 841 } | 852 } |
| 842 | 853 |
| 843 | 854 |
| 844 var h = { | 855 var h = { |
| 845 "content-type" : "application/json; charset=utf-8", | 856 "content-type" : "application/json; charset=utf-8", |
| 846 }; | 857 }; |
| 847 var resp = convert.JSON.encode(buildListOperationsResponse()); | 858 var resp = convert.JSON.encode(buildListOperationsResponse()); |
| 848 return new async.Future.value(stringResponse(200, h, resp)); | 859 return new async.Future.value(stringResponse(200, h, resp)); |
| 849 }), true); | 860 }), true); |
| 850 res.list(arg_projectId, arg_zoneId).then(unittest.expectAsync(((api.ListOp
erationsResponse response) { | 861 res.list(arg_projectId, arg_zone).then(unittest.expectAsync(((api.ListOper
ationsResponse response) { |
| 851 checkListOperationsResponse(response); | 862 checkListOperationsResponse(response); |
| 852 }))); | 863 }))); |
| 853 }); | 864 }); |
| 854 | 865 |
| 855 }); | 866 }); |
| 856 | 867 |
| 857 | 868 |
| 858 } | 869 } |
| 859 | 870 |
| OLD | NEW |