| OLD | NEW |
| 1 library googleapis.script.v1.test; | 1 library googleapis.script.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:test/test.dart' as unittest; |
| 11 | 11 |
| 12 import 'package:googleapis/script/v1.dart' as api; | 12 import 'package:googleapis/script/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; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 39 } else { | 39 } else { |
| 40 return stream.toBytes().then((data) { | 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); | 41 return _callback(request, data); |
| 42 }); | 42 }); |
| 43 } | 43 } |
| 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<core.String, core.String> headers, core.String bod
y) { |
| 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 buildUnnamed724() { | 54 buildUnnamed731() { |
| 55 var o = new core.List<api.ScriptStackTraceElement>(); | 55 var o = new core.List<api.ScriptStackTraceElement>(); |
| 56 o.add(buildScriptStackTraceElement()); | 56 o.add(buildScriptStackTraceElement()); |
| 57 o.add(buildScriptStackTraceElement()); | 57 o.add(buildScriptStackTraceElement()); |
| 58 return o; | 58 return o; |
| 59 } | 59 } |
| 60 | 60 |
| 61 checkUnnamed724(core.List<api.ScriptStackTraceElement> o) { | 61 checkUnnamed731(core.List<api.ScriptStackTraceElement> o) { |
| 62 unittest.expect(o, unittest.hasLength(2)); | 62 unittest.expect(o, unittest.hasLength(2)); |
| 63 checkScriptStackTraceElement(o[0]); | 63 checkScriptStackTraceElement(o[0]); |
| 64 checkScriptStackTraceElement(o[1]); | 64 checkScriptStackTraceElement(o[1]); |
| 65 } | 65 } |
| 66 | 66 |
| 67 core.int buildCounterExecutionError = 0; | 67 core.int buildCounterExecutionError = 0; |
| 68 buildExecutionError() { | 68 buildExecutionError() { |
| 69 var o = new api.ExecutionError(); | 69 var o = new api.ExecutionError(); |
| 70 buildCounterExecutionError++; | 70 buildCounterExecutionError++; |
| 71 if (buildCounterExecutionError < 3) { | 71 if (buildCounterExecutionError < 3) { |
| 72 o.errorMessage = "foo"; | 72 o.errorMessage = "foo"; |
| 73 o.errorType = "foo"; | 73 o.errorType = "foo"; |
| 74 o.scriptStackTraceElements = buildUnnamed724(); | 74 o.scriptStackTraceElements = buildUnnamed731(); |
| 75 } | 75 } |
| 76 buildCounterExecutionError--; | 76 buildCounterExecutionError--; |
| 77 return o; | 77 return o; |
| 78 } | 78 } |
| 79 | 79 |
| 80 checkExecutionError(api.ExecutionError o) { | 80 checkExecutionError(api.ExecutionError o) { |
| 81 buildCounterExecutionError++; | 81 buildCounterExecutionError++; |
| 82 if (buildCounterExecutionError < 3) { | 82 if (buildCounterExecutionError < 3) { |
| 83 unittest.expect(o.errorMessage, unittest.equals('foo')); | 83 unittest.expect(o.errorMessage, unittest.equals('foo')); |
| 84 unittest.expect(o.errorType, unittest.equals('foo')); | 84 unittest.expect(o.errorType, unittest.equals('foo')); |
| 85 checkUnnamed724(o.scriptStackTraceElements); | 85 checkUnnamed731(o.scriptStackTraceElements); |
| 86 } | 86 } |
| 87 buildCounterExecutionError--; | 87 buildCounterExecutionError--; |
| 88 } | 88 } |
| 89 | 89 |
| 90 buildUnnamed725() { | 90 buildUnnamed732() { |
| 91 var o = new core.List<core.Object>(); | 91 var o = new core.List<core.Object>(); |
| 92 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | 92 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); |
| 93 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | 93 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); |
| 94 return o; | 94 return o; |
| 95 } | 95 } |
| 96 | 96 |
| 97 checkUnnamed725(core.List<core.Object> o) { | 97 checkUnnamed732(core.List<core.Object> o) { |
| 98 unittest.expect(o, unittest.hasLength(2)); | 98 unittest.expect(o, unittest.hasLength(2)); |
| 99 var casted1 = (o[0]) as core.Map; unittest.expect(casted1, unittest.hasLength(
3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], u
nittest.equals('foo')); | 99 var casted1 = (o[0]) as core.Map; unittest.expect(casted1, unittest.hasLength(
3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], u
nittest.equals('foo')); |
| 100 var casted2 = (o[1]) as core.Map; unittest.expect(casted2, unittest.hasLength(
3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], u
nittest.equals('foo')); | 100 var casted2 = (o[1]) as core.Map; unittest.expect(casted2, unittest.hasLength(
3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], u
nittest.equals('foo')); |
| 101 } | 101 } |
| 102 | 102 |
| 103 core.int buildCounterExecutionRequest = 0; | 103 core.int buildCounterExecutionRequest = 0; |
| 104 buildExecutionRequest() { | 104 buildExecutionRequest() { |
| 105 var o = new api.ExecutionRequest(); | 105 var o = new api.ExecutionRequest(); |
| 106 buildCounterExecutionRequest++; | 106 buildCounterExecutionRequest++; |
| 107 if (buildCounterExecutionRequest < 3) { | 107 if (buildCounterExecutionRequest < 3) { |
| 108 o.devMode = true; | 108 o.devMode = true; |
| 109 o.function = "foo"; | 109 o.function = "foo"; |
| 110 o.parameters = buildUnnamed725(); | 110 o.parameters = buildUnnamed732(); |
| 111 o.sessionState = "foo"; | 111 o.sessionState = "foo"; |
| 112 } | 112 } |
| 113 buildCounterExecutionRequest--; | 113 buildCounterExecutionRequest--; |
| 114 return o; | 114 return o; |
| 115 } | 115 } |
| 116 | 116 |
| 117 checkExecutionRequest(api.ExecutionRequest o) { | 117 checkExecutionRequest(api.ExecutionRequest o) { |
| 118 buildCounterExecutionRequest++; | 118 buildCounterExecutionRequest++; |
| 119 if (buildCounterExecutionRequest < 3) { | 119 if (buildCounterExecutionRequest < 3) { |
| 120 unittest.expect(o.devMode, unittest.isTrue); | 120 unittest.expect(o.devMode, unittest.isTrue); |
| 121 unittest.expect(o.function, unittest.equals('foo')); | 121 unittest.expect(o.function, unittest.equals('foo')); |
| 122 checkUnnamed725(o.parameters); | 122 checkUnnamed732(o.parameters); |
| 123 unittest.expect(o.sessionState, unittest.equals('foo')); | 123 unittest.expect(o.sessionState, unittest.equals('foo')); |
| 124 } | 124 } |
| 125 buildCounterExecutionRequest--; | 125 buildCounterExecutionRequest--; |
| 126 } | 126 } |
| 127 | 127 |
| 128 core.int buildCounterExecutionResponse = 0; | 128 core.int buildCounterExecutionResponse = 0; |
| 129 buildExecutionResponse() { | 129 buildExecutionResponse() { |
| 130 var o = new api.ExecutionResponse(); | 130 var o = new api.ExecutionResponse(); |
| 131 buildCounterExecutionResponse++; | 131 buildCounterExecutionResponse++; |
| 132 if (buildCounterExecutionResponse < 3) { | 132 if (buildCounterExecutionResponse < 3) { |
| 133 o.result = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 133 o.result = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 134 } | 134 } |
| 135 buildCounterExecutionResponse--; | 135 buildCounterExecutionResponse--; |
| 136 return o; | 136 return o; |
| 137 } | 137 } |
| 138 | 138 |
| 139 checkExecutionResponse(api.ExecutionResponse o) { | 139 checkExecutionResponse(api.ExecutionResponse o) { |
| 140 buildCounterExecutionResponse++; | 140 buildCounterExecutionResponse++; |
| 141 if (buildCounterExecutionResponse < 3) { | 141 if (buildCounterExecutionResponse < 3) { |
| 142 var casted3 = (o.result) as core.Map; unittest.expect(casted3, unittest.hasL
ength(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittes
t.expect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["strin
g"], unittest.equals('foo')); | 142 var casted3 = (o.result) as core.Map; unittest.expect(casted3, unittest.hasL
ength(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittes
t.expect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["strin
g"], unittest.equals('foo')); |
| 143 } | 143 } |
| 144 buildCounterExecutionResponse--; | 144 buildCounterExecutionResponse--; |
| 145 } | 145 } |
| 146 | 146 |
| 147 buildUnnamed726() { | 147 buildUnnamed733() { |
| 148 var o = new core.List<core.String>(); | 148 var o = new core.List<core.String>(); |
| 149 o.add("foo"); | 149 o.add("foo"); |
| 150 o.add("foo"); | 150 o.add("foo"); |
| 151 return o; | 151 return o; |
| 152 } | 152 } |
| 153 | 153 |
| 154 checkUnnamed726(core.List<core.String> o) { | 154 checkUnnamed733(core.List<core.String> o) { |
| 155 unittest.expect(o, unittest.hasLength(2)); | 155 unittest.expect(o, unittest.hasLength(2)); |
| 156 unittest.expect(o[0], unittest.equals('foo')); | 156 unittest.expect(o[0], unittest.equals('foo')); |
| 157 unittest.expect(o[1], unittest.equals('foo')); | 157 unittest.expect(o[1], unittest.equals('foo')); |
| 158 } | 158 } |
| 159 | 159 |
| 160 core.int buildCounterJoinAsyncRequest = 0; | 160 core.int buildCounterJoinAsyncRequest = 0; |
| 161 buildJoinAsyncRequest() { | 161 buildJoinAsyncRequest() { |
| 162 var o = new api.JoinAsyncRequest(); | 162 var o = new api.JoinAsyncRequest(); |
| 163 buildCounterJoinAsyncRequest++; | 163 buildCounterJoinAsyncRequest++; |
| 164 if (buildCounterJoinAsyncRequest < 3) { | 164 if (buildCounterJoinAsyncRequest < 3) { |
| 165 o.names = buildUnnamed726(); | 165 o.names = buildUnnamed733(); |
| 166 o.scriptId = "foo"; | 166 o.scriptId = "foo"; |
| 167 o.timeout = "foo"; | 167 o.timeout = "foo"; |
| 168 } | 168 } |
| 169 buildCounterJoinAsyncRequest--; | 169 buildCounterJoinAsyncRequest--; |
| 170 return o; | 170 return o; |
| 171 } | 171 } |
| 172 | 172 |
| 173 checkJoinAsyncRequest(api.JoinAsyncRequest o) { | 173 checkJoinAsyncRequest(api.JoinAsyncRequest o) { |
| 174 buildCounterJoinAsyncRequest++; | 174 buildCounterJoinAsyncRequest++; |
| 175 if (buildCounterJoinAsyncRequest < 3) { | 175 if (buildCounterJoinAsyncRequest < 3) { |
| 176 checkUnnamed726(o.names); | 176 checkUnnamed733(o.names); |
| 177 unittest.expect(o.scriptId, unittest.equals('foo')); | 177 unittest.expect(o.scriptId, unittest.equals('foo')); |
| 178 unittest.expect(o.timeout, unittest.equals('foo')); | 178 unittest.expect(o.timeout, unittest.equals('foo')); |
| 179 } | 179 } |
| 180 buildCounterJoinAsyncRequest--; | 180 buildCounterJoinAsyncRequest--; |
| 181 } | 181 } |
| 182 | 182 |
| 183 buildUnnamed727() { | 183 buildUnnamed734() { |
| 184 var o = new core.Map<core.String, api.Operation>(); | 184 var o = new core.Map<core.String, api.Operation>(); |
| 185 o["x"] = buildOperation(); | 185 o["x"] = buildOperation(); |
| 186 o["y"] = buildOperation(); | 186 o["y"] = buildOperation(); |
| 187 return o; | 187 return o; |
| 188 } | 188 } |
| 189 | 189 |
| 190 checkUnnamed727(core.Map<core.String, api.Operation> o) { | 190 checkUnnamed734(core.Map<core.String, api.Operation> o) { |
| 191 unittest.expect(o, unittest.hasLength(2)); | 191 unittest.expect(o, unittest.hasLength(2)); |
| 192 checkOperation(o["x"]); | 192 checkOperation(o["x"]); |
| 193 checkOperation(o["y"]); | 193 checkOperation(o["y"]); |
| 194 } | 194 } |
| 195 | 195 |
| 196 core.int buildCounterJoinAsyncResponse = 0; | 196 core.int buildCounterJoinAsyncResponse = 0; |
| 197 buildJoinAsyncResponse() { | 197 buildJoinAsyncResponse() { |
| 198 var o = new api.JoinAsyncResponse(); | 198 var o = new api.JoinAsyncResponse(); |
| 199 buildCounterJoinAsyncResponse++; | 199 buildCounterJoinAsyncResponse++; |
| 200 if (buildCounterJoinAsyncResponse < 3) { | 200 if (buildCounterJoinAsyncResponse < 3) { |
| 201 o.results = buildUnnamed727(); | 201 o.results = buildUnnamed734(); |
| 202 } | 202 } |
| 203 buildCounterJoinAsyncResponse--; | 203 buildCounterJoinAsyncResponse--; |
| 204 return o; | 204 return o; |
| 205 } | 205 } |
| 206 | 206 |
| 207 checkJoinAsyncResponse(api.JoinAsyncResponse o) { | 207 checkJoinAsyncResponse(api.JoinAsyncResponse o) { |
| 208 buildCounterJoinAsyncResponse++; | 208 buildCounterJoinAsyncResponse++; |
| 209 if (buildCounterJoinAsyncResponse < 3) { | 209 if (buildCounterJoinAsyncResponse < 3) { |
| 210 checkUnnamed727(o.results); | 210 checkUnnamed734(o.results); |
| 211 } | 211 } |
| 212 buildCounterJoinAsyncResponse--; | 212 buildCounterJoinAsyncResponse--; |
| 213 } | 213 } |
| 214 | 214 |
| 215 buildUnnamed728() { | 215 buildUnnamed735() { |
| 216 var o = new core.Map<core.String, core.Object>(); | 216 var o = new core.Map<core.String, core.Object>(); |
| 217 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 217 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 218 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 218 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 219 return o; | 219 return o; |
| 220 } | 220 } |
| 221 | 221 |
| 222 checkUnnamed728(core.Map<core.String, core.Object> o) { | 222 checkUnnamed735(core.Map<core.String, core.Object> o) { |
| 223 unittest.expect(o, unittest.hasLength(2)); | 223 unittest.expect(o, unittest.hasLength(2)); |
| 224 var casted4 = (o["x"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); | 224 var casted4 = (o["x"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); |
| 225 var casted5 = (o["y"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); | 225 var casted5 = (o["y"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); |
| 226 } | 226 } |
| 227 | 227 |
| 228 buildUnnamed729() { | 228 buildUnnamed736() { |
| 229 var o = new core.Map<core.String, core.Object>(); | 229 var o = new core.Map<core.String, core.Object>(); |
| 230 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 230 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 231 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 231 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 232 return o; | 232 return o; |
| 233 } | 233 } |
| 234 | 234 |
| 235 checkUnnamed729(core.Map<core.String, core.Object> o) { | 235 checkUnnamed736(core.Map<core.String, core.Object> o) { |
| 236 unittest.expect(o, unittest.hasLength(2)); | 236 unittest.expect(o, unittest.hasLength(2)); |
| 237 var casted6 = (o["x"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); | 237 var casted6 = (o["x"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); |
| 238 var casted7 = (o["y"]) as core.Map; unittest.expect(casted7, unittest.hasLengt
h(3)); unittest.expect(casted7["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted7["bool"], unittest.equals(true)); unittest.expect(casted7["string"],
unittest.equals('foo')); | 238 var casted7 = (o["y"]) as core.Map; unittest.expect(casted7, unittest.hasLengt
h(3)); unittest.expect(casted7["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted7["bool"], unittest.equals(true)); unittest.expect(casted7["string"],
unittest.equals('foo')); |
| 239 } | 239 } |
| 240 | 240 |
| 241 core.int buildCounterOperation = 0; | 241 core.int buildCounterOperation = 0; |
| 242 buildOperation() { | 242 buildOperation() { |
| 243 var o = new api.Operation(); | 243 var o = new api.Operation(); |
| 244 buildCounterOperation++; | 244 buildCounterOperation++; |
| 245 if (buildCounterOperation < 3) { | 245 if (buildCounterOperation < 3) { |
| 246 o.done = true; | 246 o.done = true; |
| 247 o.error = buildStatus(); | 247 o.error = buildStatus(); |
| 248 o.metadata = buildUnnamed728(); | 248 o.metadata = buildUnnamed735(); |
| 249 o.name = "foo"; | 249 o.name = "foo"; |
| 250 o.response = buildUnnamed729(); | 250 o.response = buildUnnamed736(); |
| 251 } | 251 } |
| 252 buildCounterOperation--; | 252 buildCounterOperation--; |
| 253 return o; | 253 return o; |
| 254 } | 254 } |
| 255 | 255 |
| 256 checkOperation(api.Operation o) { | 256 checkOperation(api.Operation o) { |
| 257 buildCounterOperation++; | 257 buildCounterOperation++; |
| 258 if (buildCounterOperation < 3) { | 258 if (buildCounterOperation < 3) { |
| 259 unittest.expect(o.done, unittest.isTrue); | 259 unittest.expect(o.done, unittest.isTrue); |
| 260 checkStatus(o.error); | 260 checkStatus(o.error); |
| 261 checkUnnamed728(o.metadata); | 261 checkUnnamed735(o.metadata); |
| 262 unittest.expect(o.name, unittest.equals('foo')); | 262 unittest.expect(o.name, unittest.equals('foo')); |
| 263 checkUnnamed729(o.response); | 263 checkUnnamed736(o.response); |
| 264 } | 264 } |
| 265 buildCounterOperation--; | 265 buildCounterOperation--; |
| 266 } | 266 } |
| 267 | 267 |
| 268 core.int buildCounterScriptStackTraceElement = 0; | 268 core.int buildCounterScriptStackTraceElement = 0; |
| 269 buildScriptStackTraceElement() { | 269 buildScriptStackTraceElement() { |
| 270 var o = new api.ScriptStackTraceElement(); | 270 var o = new api.ScriptStackTraceElement(); |
| 271 buildCounterScriptStackTraceElement++; | 271 buildCounterScriptStackTraceElement++; |
| 272 if (buildCounterScriptStackTraceElement < 3) { | 272 if (buildCounterScriptStackTraceElement < 3) { |
| 273 o.function = "foo"; | 273 o.function = "foo"; |
| 274 o.lineNumber = 42; | 274 o.lineNumber = 42; |
| 275 } | 275 } |
| 276 buildCounterScriptStackTraceElement--; | 276 buildCounterScriptStackTraceElement--; |
| 277 return o; | 277 return o; |
| 278 } | 278 } |
| 279 | 279 |
| 280 checkScriptStackTraceElement(api.ScriptStackTraceElement o) { | 280 checkScriptStackTraceElement(api.ScriptStackTraceElement o) { |
| 281 buildCounterScriptStackTraceElement++; | 281 buildCounterScriptStackTraceElement++; |
| 282 if (buildCounterScriptStackTraceElement < 3) { | 282 if (buildCounterScriptStackTraceElement < 3) { |
| 283 unittest.expect(o.function, unittest.equals('foo')); | 283 unittest.expect(o.function, unittest.equals('foo')); |
| 284 unittest.expect(o.lineNumber, unittest.equals(42)); | 284 unittest.expect(o.lineNumber, unittest.equals(42)); |
| 285 } | 285 } |
| 286 buildCounterScriptStackTraceElement--; | 286 buildCounterScriptStackTraceElement--; |
| 287 } | 287 } |
| 288 | 288 |
| 289 buildUnnamed730() { | 289 buildUnnamed737() { |
| 290 var o = new core.Map<core.String, core.Object>(); | 290 var o = new core.Map<core.String, core.Object>(); |
| 291 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 291 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 292 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 292 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 293 return o; | 293 return o; |
| 294 } | 294 } |
| 295 | 295 |
| 296 checkUnnamed730(core.Map<core.String, core.Object> o) { | 296 checkUnnamed737(core.Map<core.String, core.Object> o) { |
| 297 unittest.expect(o, unittest.hasLength(2)); | 297 unittest.expect(o, unittest.hasLength(2)); |
| 298 var casted8 = (o["x"]) as core.Map; unittest.expect(casted8, unittest.hasLengt
h(3)); unittest.expect(casted8["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted8["bool"], unittest.equals(true)); unittest.expect(casted8["string"],
unittest.equals('foo')); | 298 var casted8 = (o["x"]) as core.Map; unittest.expect(casted8, unittest.hasLengt
h(3)); unittest.expect(casted8["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted8["bool"], unittest.equals(true)); unittest.expect(casted8["string"],
unittest.equals('foo')); |
| 299 var casted9 = (o["y"]) as core.Map; unittest.expect(casted9, unittest.hasLengt
h(3)); unittest.expect(casted9["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted9["bool"], unittest.equals(true)); unittest.expect(casted9["string"],
unittest.equals('foo')); | 299 var casted9 = (o["y"]) as core.Map; unittest.expect(casted9, unittest.hasLengt
h(3)); unittest.expect(casted9["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted9["bool"], unittest.equals(true)); unittest.expect(casted9["string"],
unittest.equals('foo')); |
| 300 } | 300 } |
| 301 | 301 |
| 302 buildUnnamed731() { | 302 buildUnnamed738() { |
| 303 var o = new core.List<core.Map<core.String, core.Object>>(); | 303 var o = new core.List<core.Map<core.String, core.Object>>(); |
| 304 o.add(buildUnnamed730()); | 304 o.add(buildUnnamed737()); |
| 305 o.add(buildUnnamed730()); | 305 o.add(buildUnnamed737()); |
| 306 return o; | 306 return o; |
| 307 } | 307 } |
| 308 | 308 |
| 309 checkUnnamed731(core.List<core.Map<core.String, core.Object>> o) { | 309 checkUnnamed738(core.List<core.Map<core.String, core.Object>> o) { |
| 310 unittest.expect(o, unittest.hasLength(2)); | 310 unittest.expect(o, unittest.hasLength(2)); |
| 311 checkUnnamed730(o[0]); | 311 checkUnnamed737(o[0]); |
| 312 checkUnnamed730(o[1]); | 312 checkUnnamed737(o[1]); |
| 313 } | 313 } |
| 314 | 314 |
| 315 core.int buildCounterStatus = 0; | 315 core.int buildCounterStatus = 0; |
| 316 buildStatus() { | 316 buildStatus() { |
| 317 var o = new api.Status(); | 317 var o = new api.Status(); |
| 318 buildCounterStatus++; | 318 buildCounterStatus++; |
| 319 if (buildCounterStatus < 3) { | 319 if (buildCounterStatus < 3) { |
| 320 o.code = 42; | 320 o.code = 42; |
| 321 o.details = buildUnnamed731(); | 321 o.details = buildUnnamed738(); |
| 322 o.message = "foo"; | 322 o.message = "foo"; |
| 323 } | 323 } |
| 324 buildCounterStatus--; | 324 buildCounterStatus--; |
| 325 return o; | 325 return o; |
| 326 } | 326 } |
| 327 | 327 |
| 328 checkStatus(api.Status o) { | 328 checkStatus(api.Status o) { |
| 329 buildCounterStatus++; | 329 buildCounterStatus++; |
| 330 if (buildCounterStatus < 3) { | 330 if (buildCounterStatus < 3) { |
| 331 unittest.expect(o.code, unittest.equals(42)); | 331 unittest.expect(o.code, unittest.equals(42)); |
| 332 checkUnnamed731(o.details); | 332 checkUnnamed738(o.details); |
| 333 unittest.expect(o.message, unittest.equals('foo')); | 333 unittest.expect(o.message, unittest.equals('foo')); |
| 334 } | 334 } |
| 335 buildCounterStatus--; | 335 buildCounterStatus--; |
| 336 } | 336 } |
| 337 | 337 |
| 338 | 338 |
| 339 main() { | 339 main() { |
| 340 unittest.group("obj-schema-ExecutionError", () { | 340 unittest.group("obj-schema-ExecutionError", () { |
| 341 unittest.test("to-json--from-json", () { | 341 unittest.test("to-json--from-json", () { |
| 342 var o = buildExecutionError(); | 342 var o = buildExecutionError(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 }); | 409 }); |
| 410 | 410 |
| 411 | 411 |
| 412 unittest.group("resource-ScriptsResourceApi", () { | 412 unittest.group("resource-ScriptsResourceApi", () { |
| 413 unittest.test("method--run", () { | 413 unittest.test("method--run", () { |
| 414 | 414 |
| 415 var mock = new HttpServerMock(); | 415 var mock = new HttpServerMock(); |
| 416 api.ScriptsResourceApi res = new api.ScriptApi(mock).scripts; | 416 api.ScriptsResourceApi res = new api.ScriptApi(mock).scripts; |
| 417 var arg_request = buildExecutionRequest(); | 417 var arg_request = buildExecutionRequest(); |
| 418 var arg_scriptId = "foo"; | 418 var arg_scriptId = "foo"; |
| 419 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 419 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 420 var obj = new api.ExecutionRequest.fromJson(json); | 420 var obj = new api.ExecutionRequest.fromJson(json); |
| 421 checkExecutionRequest(obj); | 421 checkExecutionRequest(obj); |
| 422 | 422 |
| 423 var path = (req.url).path; | 423 var path = (req.url).path; |
| 424 var pathOffset = 0; | 424 var pathOffset = 0; |
| 425 var index; | 425 var index; |
| 426 var subPart; | 426 var subPart; |
| 427 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 427 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 428 pathOffset += 1; | 428 pathOffset += 1; |
| 429 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/scripts/")); | 429 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/scripts/")); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 453 } | 453 } |
| 454 } | 454 } |
| 455 | 455 |
| 456 | 456 |
| 457 var h = { | 457 var h = { |
| 458 "content-type" : "application/json; charset=utf-8", | 458 "content-type" : "application/json; charset=utf-8", |
| 459 }; | 459 }; |
| 460 var resp = convert.JSON.encode(buildOperation()); | 460 var resp = convert.JSON.encode(buildOperation()); |
| 461 return new async.Future.value(stringResponse(200, h, resp)); | 461 return new async.Future.value(stringResponse(200, h, resp)); |
| 462 }), true); | 462 }), true); |
| 463 res.run(arg_request, arg_scriptId).then(unittest.expectAsync(((api.Operati
on response) { | 463 res.run(arg_request, arg_scriptId).then(unittest.expectAsync1(((api.Operat
ion response) { |
| 464 checkOperation(response); | 464 checkOperation(response); |
| 465 }))); | 465 }))); |
| 466 }); | 466 }); |
| 467 | 467 |
| 468 }); | 468 }); |
| 469 | 469 |
| 470 | 470 |
| 471 } | 471 } |
| 472 | 472 |
| OLD | NEW |