Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 json: { 'Content-Type': 'application/json' } | 43 json: { 'Content-Type': 'application/json' } |
| 44 }; | 44 }; |
| 45 var config_set; | 45 var config_set; |
| 46 | 46 |
| 47 setup(function() { | 47 setup(function() { |
| 48 server = sinon.fakeServer.create(); | 48 server = sinon.fakeServer.create(); |
| 49 var param = { | 49 var param = { |
| 50 config_sets: [{ | 50 config_sets: [{ |
| 51 files: [{path: "OWNERS"}, {path: "README.md"}], | 51 files: [{path: "OWNERS"}, {path: "README.md"}], |
| 52 location: "https://test.com/valid-project-with-config-files", | 52 location: "https://test.com/valid-project-with-config-files", |
| 53 last_import_attempt: {success: true} | 53 last_import_attempt: { |
| 54 success: true, | |
| 55 revision: { | |
| 56 url: "https://test.com/valid-project-with-config-files" | |
|
Sergey Berezin
2017/07/27 21:14:14
Make this URL different from `location`, so you ca
cwpayton
2017/07/27 22:56:04
Done.
| |
| 57 } | |
| 58 } | |
| 54 }] | 59 }] |
| 55 }; | 60 }; |
| 56 server.respondWith( | 61 server.respondWith( |
| 57 'GET', | 62 'GET', |
| 58 /\/_ah\/api\/config\/v1\/config-sets\?config_set=([a-z\-]+)\/([a-z\- ]+)&include_files=true&include_last_import_attempt=true/, | 63 /\/_ah\/api\/config\/v1\/config-sets\?config_set=([a-z\-]+)\/([a-z\- ]+)&include_files=true&include_last_import_attempt=true/, |
| 59 [ | 64 [ |
| 60 200, | 65 200, |
| 61 responseHeaders.json, | 66 responseHeaders.json, |
| 62 JSON.stringify(param) | 67 JSON.stringify(param) |
| 63 ] | 68 ] |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 84 | 89 |
| 85 test('gets iron-ajax response', function (done) { | 90 test('gets iron-ajax response', function (done) { |
| 86 request = ajax.generateRequest(); | 91 request = ajax.generateRequest(); |
| 87 server.respond(); | 92 server.respond(); |
| 88 assert.equal(request.status, 200); | 93 assert.equal(request.status, 200); |
| 89 assert.isObject(request.response); | 94 assert.isObject(request.response); |
| 90 config_set.addEventListener('processedConfigFiles', function() { | 95 config_set.addEventListener('processedConfigFiles', function() { |
| 91 assert.equal(config_set.isLoading, false); | 96 assert.equal(config_set.isLoading, false); |
| 92 assert.equal(config_set.files.length, 2); | 97 assert.equal(config_set.files.length, 2); |
| 93 assert.equal(config_set.lastImportAttempt.success, true); | 98 assert.equal(config_set.lastImportAttempt.success, true); |
| 94 assert.equal(config_set.location, | 99 assert.equal(config_set.url, |
| 95 "https://test.com/valid-project-with-config-files"); | 100 "https://test.com/valid-project-with-config-files"); |
| 96 done(); | 101 done(); |
| 97 }.bind(config_set)); | 102 }.bind(config_set)); |
| 98 }); | 103 }); |
| 99 }); | 104 }); |
| 100 | 105 |
| 101 suite('Inalid project without config files', function() { | 106 suite('Inalid project without config files', function() { |
| 102 var ajax; | 107 var ajax; |
| 103 var request; | 108 var request; |
| 104 var server; | 109 var server; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 | 151 |
| 147 test('gets iron-ajax response', function (done) { | 152 test('gets iron-ajax response', function (done) { |
| 148 request = ajax.generateRequest(); | 153 request = ajax.generateRequest(); |
| 149 server.respond(); | 154 server.respond(); |
| 150 assert.equal(request.status, 200); | 155 assert.equal(request.status, 200); |
| 151 assert.isObject(request.response); | 156 assert.isObject(request.response); |
| 152 config_set.addEventListener('processedConfigFiles', function() { | 157 config_set.addEventListener('processedConfigFiles', function() { |
| 153 assert.equal(config_set.isLoading, false); | 158 assert.equal(config_set.isLoading, false); |
| 154 assert.equal(config_set.files.length, 0); | 159 assert.equal(config_set.files.length, 0); |
| 155 assert.equal(config_set.lastImportAttempt.success, false); | 160 assert.equal(config_set.lastImportAttempt.success, false); |
| 156 assert.equal(config_set.location, | 161 assert.equal(config_set.url, |
| 157 "https://test.com/invalid-project-without-config-files"); | 162 "https://test.com/invalid-project-without-config-files"); |
| 158 done(); | 163 done(); |
| 159 }.bind(config_set)); | 164 }.bind(config_set)); |
| 160 }); | 165 }); |
| 161 }); | 166 }); |
| 162 | 167 |
| 163 suite('Successful force refresh', function() { | 168 suite('Successful force refresh', function() { |
| 164 var ajax; | 169 var ajax; |
| 165 var request; | 170 var request; |
| 166 var server; | 171 var server; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 assert.equal(config_set.errorMessage, "Internal server error."); | 335 assert.equal(config_set.errorMessage, "Internal server error."); |
| 331 done(); | 336 done(); |
| 332 }.bind(config_set)); | 337 }.bind(config_set)); |
| 333 }); | 338 }); |
| 334 | 339 |
| 335 }); | 340 }); |
| 336 | 341 |
| 337 </script> | 342 </script> |
| 338 </body> | 343 </body> |
| 339 </html> | 344 </html> |
| OLD | NEW |