Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: appengine/config_service/ui/test/config-ui/config-set_test.html

Issue 2990713002: config_service: change error message for error 403. (Closed)
Patch Set: Nit: fix tests to reflect recent changes Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 setup(function() { 265 setup(function() {
266 server = sinon.fakeServer.create(); 266 server = sinon.fakeServer.create();
267 config_set = fixture('valid-project-with-config-files'); 267 config_set = fixture('valid-project-with-config-files');
268 ajax = Polymer.dom(config_set.root).querySelector('#requestConfigs'); 268 ajax = Polymer.dom(config_set.root).querySelector('#requestConfigs');
269 }); 269 });
270 270
271 teardown(function() { 271 teardown(function() {
272 server.restore(); 272 server.restore();
273 }); 273 });
274 274
275 test('displays error if fetch failed due to error 403', function (done) { 275 test('displays error if fetch failed due to error 403 when not signed in ', function (done) {
Sergey Berezin 2017/07/27 00:05:31 nit: break the line to fit in 80 char. Or consider
ayanaadylova 2017/07/27 16:57:29 Done.
Sergey Berezin 2017/07/27 20:42:18 This wasn't actually done... Similarly other test
276 param = { 276 param = {
277 error: { 277 error: {
278 code: 403, 278 code: 403,
279 message: "Error 403" 279 message: "Error 403"
280 } 280 }
281 } 281 }
282 server.respondWith( 282 server.respondWith(
283 'GET', 283 'GET',
284 /\/_ah\/api\/config\/v1\/config-sets\?config_set=([a-z\-]+)\/([a-z\- ]+)&include_files=true&include_last_import_attempt=true/, 284 /\/_ah\/api\/config\/v1\/config-sets\?config_set=([a-z\-]+)\/([a-z\- ]+)&include_files=true&include_last_import_attempt=true/,
285 [ 285 [
286 403, 286 403,
287 responseHeaders.json, 287 responseHeaders.json,
288 JSON.stringify(param) 288 JSON.stringify(param)
289 ] 289 ]
290 ); 290 );
291 request = ajax.generateRequest(); 291 request = ajax.generateRequest();
292 server.respond(); 292 server.respond();
293 assert.equal(request.status, 403); 293 assert.equal(request.status, 403);
294 config_set.addEventListener('fetchError', function() { 294 config_set.addEventListener('fetchError', function() {
295 assert.equal(config_set.isLoading, false); 295 assert.equal(config_set.isLoading, false);
296 assert.equal(config_set.errorMessage, "Authorization required to vie w this config set." + 296 assert.equal(config_set.errorMessage, "Access denied, please sign in .");
Sergey Berezin 2017/07/27 00:05:31 nit: line break to fit in 80 char
ayanaadylova 2017/07/27 16:57:29 Done.
297 " Please sign in.");
298 done(); 297 done();
299 }.bind(config_set)); 298 }.bind(config_set));
300 }); 299 });
300
301 test('displays error if fetch failed due to error 403 when signed in', f unction (done) {
Sergey Berezin 2017/07/27 00:05:31 nit: same as above - fit in 80 char, possibly by s
ayanaadylova 2017/07/27 16:57:29 Done.
302 param = {
Sergey Berezin 2017/07/27 00:05:31 Suggestion: consider creating a separate helper fu
ayanaadylova 2017/07/27 16:57:29 Done.
303 error: {
304 code: 403,
305 message: "Error 403"
306 }
307 }
308 server.respondWith(
309 'GET',
310 /\/_ah\/api\/config\/v1\/config-sets\?config_set=([a-z\-]+)\/([a-z\- ]+)&include_files=true&include_last_import_attempt=true/,
311 [
312 403,
313 responseHeaders.json,
314 JSON.stringify(param)
315 ]
316 );
317 config_set.auth_headers = {};
318 config_set.profile = {
319 email: "some_email@google.com"
320 };
321 request = ajax.generateRequest();
322 server.respond();
323 assert.equal(request.status, 403);
324 config_set.addEventListener('fetchError', function() {
325 assert.equal(config_set.isLoading, false);
326 assert.equal(config_set.errorMessage, "Access denied, some_email@goo gle.com" +
Sergey Berezin 2017/07/27 00:05:31 nit: move the second arg to new line to fit in 80
ayanaadylova 2017/07/27 16:57:29 Done.
327 " is not authorized to access this config set." +
328 " Request access or sign in as a different user.");
329 done();
330 }.bind(config_set));
331 });
301 332
302 test('displays error if fetch failed due to error 500', function (done) { 333 test('displays error if fetch failed due to error 500', function (done) {
303 param = { 334 param = {
304 error: { 335 error: {
305 code: 500, 336 code: 500,
306 message: "Error 500" 337 message: "Error 500"
307 } 338 }
308 } 339 }
309 server.respondWith( 340 server.respondWith(
310 'GET', 341 'GET',
(...skipping 12 matching lines...) Expand all
323 assert.equal(config_set.errorMessage, "Internal server error."); 354 assert.equal(config_set.errorMessage, "Internal server error.");
324 done(); 355 done();
325 }.bind(config_set)); 356 }.bind(config_set));
326 }); 357 });
327 358
328 }); 359 });
329 360
330 </script> 361 </script>
331 </body> 362 </body>
332 </html> 363 </html>
OLDNEW
« no previous file with comments | « appengine/config_service/ui/src/config-ui/front-page.html ('k') | appengine/config_service/ui/test/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698