| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2017 The LUCI Authors. All rights reserved. | 2 Copyright 2017 The LUCI Authors. All rights reserved. |
| 3 Use of this source code is governed under the Apache License, Version 2.0 | 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. | 4 that can be found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <!doctype html> | 7 <!doctype html> |
| 8 <html lang="en"> | 8 <html lang="en"> |
| 9 <head> | 9 <head> |
| 10 <meta charset="utf-8"> | 10 <meta charset="utf-8"> |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 request = ajax.generateRequest(); | 244 request = ajax.generateRequest(); |
| 245 server.respond(); | 245 server.respond(); |
| 246 assert.equal(request.status, 404); | 246 assert.equal(request.status, 404); |
| 247 config_set.addEventListener('refreshError', function() { | 247 config_set.addEventListener('refreshError', function() { |
| 248 assert.equal(config_set.isRefreshing, false); | 248 assert.equal(config_set.isRefreshing, false); |
| 249 assert.equal(config_set.refreshMessage, "Error: Files could not be r
efreshed."); | 249 assert.equal(config_set.refreshMessage, "Error: Files could not be r
efreshed."); |
| 250 done(); | 250 done(); |
| 251 }.bind(config_set)); | 251 }.bind(config_set)); |
| 252 }); | 252 }); |
| 253 }); | 253 }); |
| 254 |
| 255 suite('Unsuccessful fetch of config files', function() { |
| 256 var ajax; |
| 257 var request; |
| 258 var server; |
| 259 var responseHeaders = { |
| 260 json: { 'Content-Type': 'application/json' } |
| 261 }; |
| 262 var config_set; |
| 263 |
| 264 setup(function() { |
| 265 server = sinon.fakeServer.create(); |
| 266 var param = { |
| 267 error: { |
| 268 code: 403, |
| 269 message: "Error 403" |
| 270 } |
| 271 } |
| 272 server.respondWith( |
| 273 'GET', |
| 274 /\/_ah\/api\/config\/v1\/config-sets\?config_set=([a-z\-]+)\/([a-z\-
]+)&include_files=true&include_last_import_attempt=true/, |
| 275 [ |
| 276 403, |
| 277 responseHeaders.json, |
| 278 JSON.stringify(param) |
| 279 ] |
| 280 ); |
| 281 config_set = fixture('valid-project-with-config-files'); |
| 282 ajax = Polymer.dom(config_set.root).querySelector('#requestConfigs'); |
| 283 }); |
| 284 |
| 285 teardown(function() { |
| 286 server.restore(); |
| 287 }); |
| 288 |
| 289 test('displays error if fetch failed', function (done) { |
| 290 request = ajax.generateRequest(); |
| 291 server.respond(); |
| 292 assert.equal(request.status, 403); |
| 293 config_set.addEventListener('fetchError', function() { |
| 294 assert.equal(config_set.isLoading, false); |
| 295 assert.equal(config_set.errorMessage, "Authorization required to vie
w this config set." + |
| 296 " You need to sign in first."); |
| 297 done(); |
| 298 }.bind(config_set)); |
| 299 }); |
| 300 }); |
| 301 |
| 254 </script> | 302 </script> |
| 255 </body> | 303 </body> |
| 256 </html> | 304 </html> |
| OLD | NEW |