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

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

Issue 2985223002: config_service: Changed file links to point to latest revision instead of master (Closed)
Patch Set: Created a function to set up server properly for each test Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/config_service/ui/src/config-ui/config-set.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/config_service/ui/test/config-ui/config-set_test.html
diff --git a/appengine/config_service/ui/test/config-ui/config-set_test.html b/appengine/config_service/ui/test/config-ui/config-set_test.html
index 6259abdff2eb82b5f6addea76b55366d98a25dc8..a3cd238147d06edccc1dd71a43a4178d7850150d 100644
--- a/appengine/config_service/ui/test/config-ui/config-set_test.html
+++ b/appengine/config_service/ui/test/config-ui/config-set_test.html
@@ -46,29 +46,25 @@
setup(function() {
server = sinon.fakeServer.create();
- var param = {
- config_sets: [{
- files: [{path: "OWNERS"}, {path: "README.md"}],
- location: "https://test.com/valid-project-with-config-files",
- last_import_attempt: {success: true}
- }]
- };
+ config_set = fixture('valid-project-with-config-files');
+ ajax = Polymer.dom(config_set.root).querySelector('#requestConfigs');
+ });
+
+ teardown(function() {
+ server.restore();
+ });
+
+ function setserver(param) {
server.respondWith(
'GET',
- /\/_ah\/api\/config\/v1\/config-sets\?config_set=([a-z\-]+)\/([a-z\-]+)&include_files=true&include_last_import_attempt=true/,
+ /\/_ah\/api\/config\/v1\/config-sets\?config_set=([a-z\-]+)\/([a-z\-]+)&include_files=true&include_last_import_attempt=true/,
[
200,
responseHeaders.json,
JSON.stringify(param)
]
);
- config_set = fixture('valid-project-with-config-files');
- ajax = Polymer.dom(config_set.root).querySelector('#requestConfigs');
- });
-
- teardown(function() {
- server.restore();
- });
+ }
test('has correct category', function() {
assert.equal(config_set.category, 'projects');
@@ -83,6 +79,13 @@
});
test('gets iron-ajax response', function (done) {
+ var param = {
+ config_sets: [{
+ files: [{path: "OWNERS"}, {path: "README.md"}],
+ last_import_attempt: { success: true },
+ }]
+ };
+ setserver(param);
request = ajax.generateRequest();
server.respond();
assert.equal(request.status, 200);
@@ -91,8 +94,49 @@
assert.equal(config_set.isLoading, false);
assert.equal(config_set.files.length, 2);
assert.equal(config_set.lastImportAttempt.success, true);
- assert.equal(config_set.location,
- "https://test.com/valid-project-with-config-files");
+ done();
+ }.bind(config_set));
+ });
+
+ test('correct url when revision is provided', function(done) {
Sergey Berezin 2017/07/27 23:03:58 nit: '_has_ correct url...'
cwpayton 2017/07/27 23:14:26 Done.
+ var param = {
+ config_sets: [{
+ files: [{path: "OWNERS"}, {path: "README.md"}],
+ location: "https://test.com/refs/master/valid-project-with-config-files",
+ last_import_attempt: {
+ success: true,
+ revision: {
+ url: "https://test.com/120c81237zv23hj22/valid-project-with-config-files",
+ timestamp: "1501162530000000"
+ }
+ },
+ revision: {
+ url: "https://test.com/120c81237zv23hj22/valid-project-with-config-files",
+ id: "4acc18843ff0b8cc858d4cc92ea6fe030cefc2b7"
+ }
+ }]
+ };
+ setserver(param);
+ request = ajax.generateRequest();
+ server.respond();
+ config_set.addEventListener('processedConfigFiles', function() {
+ assert.equal(config_set.url, "https://test.com/120c81237zv23hj22/valid-project-with-config-files");
+ done();
+ }.bind(config_set));
+ });
+
+ test('correct url when revision is not provided', function(done) {
Sergey Berezin 2017/07/27 23:03:58 nit: 'has correct url...'
cwpayton 2017/07/27 23:14:26 Done.
+ var param = {
+ config_sets: [{
+ files: [{path: "OWNERS"}, {path: "README.md"}],
+ location: "https://test.com/refs/master/valid-project-with-config-files",
+ }]
+ };
+ setserver(param);
+ request = ajax.generateRequest();
+ server.respond();
+ config_set.addEventListener('processedConfigFiles', function() {
+ assert.equal(config_set.url, "https://test.com/refs/master/valid-project-with-config-files");
done();
}.bind(config_set));
});
@@ -153,7 +197,7 @@
assert.equal(config_set.isLoading, false);
assert.equal(config_set.files.length, 0);
assert.equal(config_set.lastImportAttempt.success, false);
- assert.equal(config_set.location,
+ assert.equal(config_set.url,
"https://test.com/invalid-project-without-config-files");
done();
}.bind(config_set));
« no previous file with comments | « appengine/config_service/ui/src/config-ui/config-set.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698