Merge lp:~gary/juju-gui/removeCharmworldV3Flag into lp:juju-gui/experimental
- removeCharmworldV3Flag
- Merge into trunk
Proposed by
Gary Poster
Status: | Merged |
---|---|
Merged at revision: | 1180 |
Proposed branch: | lp:~gary/juju-gui/removeCharmworldV3Flag |
Merge into: | lp:juju-gui/experimental |
Diff against target: |
1138 lines (+59/-578) 21 files modified
app/app.js (+3/-7) app/store/charmworld.js (+0/-215) app/subapps/browser/browser.js (+1/-1) app/views/topology/bundle.js (+1/-1) test/test_app.js (+1/-1) test/test_browser_app.js (+11/-11) test/test_browser_charm_details.js (+10/-10) test/test_browser_editorial.js (+8/-8) test/test_browser_search_view.js (+6/-6) test/test_browser_search_widget.js (+1/-1) test/test_bundle_details_view.js (+1/-1) test/test_charmworld.js (+3/-298) test/test_environment_view.js (+3/-3) test/test_ghost_inspector.js (+1/-1) test/test_inspector_charm.js (+2/-2) test/test_inspector_constraints.js (+1/-1) test/test_inspector_overview.js (+1/-1) test/test_inspector_settings.js (+1/-1) test/test_model.js (+1/-1) test/test_service_module.js (+1/-1) test/utils.js (+2/-7) |
To merge this branch: | bzr merge lp:~gary/juju-gui/removeCharmworldV3Flag |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email:
|
Commit message
Description of the change
Remove charmworldv3 and APIv2
For QA, make sure that you can search for bundles (e.g., search for hatch) and make sure that the charm store seems to be working correctly.
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Gary Poster (gary) wrote : | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Richard Harding (rharding) wrote : | # |
code looks good, checking qa
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Richard Harding (rharding) wrote : | # |
LGTM qa-ok. Thanks for the update Here we goooooo!
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brad Crittenden (bac) wrote : | # |
LGTM, no qa
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Gary Poster (gary) wrote : | # |
*** Submitted:
Remove charmworldv3 and APIv2
For QA, make sure that you can search for bundles (e.g., search for
hatch) and make sure that the charm store seems to be working correctly.
R=rharding, bac
CC=
https:/
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Gary Poster (gary) wrote : | # |
Thank you both!
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'app/app.js' |
2 | --- app/app.js 2013-10-30 11:59:48 +0000 |
3 | +++ app/app.js 2013-11-05 18:17:46 +0000 |
4 | @@ -1222,8 +1222,8 @@ |
5 | }, |
6 | /** |
7 | @attribute store |
8 | - @default Y.juju.charmworld.APIv2 |
9 | - @type {Y.juju.charmworld.APIv2} |
10 | + @default Y.juju.charmworld.APIv3 |
11 | + @type {Y.juju.charmworld.APIv3} |
12 | */ |
13 | store: { |
14 | /** |
15 | @@ -1245,11 +1245,7 @@ |
16 | } else { |
17 | cfg.apiHost = window.juju_config.charmworldURL; |
18 | } |
19 | - if (window.flags.charmworldv3) { |
20 | - return new Y.juju.charmworld.APIv3(cfg); |
21 | - } else { |
22 | - return new Y.juju.charmworld.APIv2(cfg); |
23 | - } |
24 | + return new Y.juju.charmworld.APIv3(cfg); |
25 | } |
26 | }, |
27 | |
28 | |
29 | === modified file 'app/store/charmworld.js' |
30 | --- app/store/charmworld.js 2013-10-25 23:49:42 +0000 |
31 | +++ app/store/charmworld.js 2013-11-05 18:17:46 +0000 |
32 | @@ -598,221 +598,6 @@ |
33 | } |
34 | }); |
35 | |
36 | - /** |
37 | - * Charmworld API version 2 interface. |
38 | - * |
39 | - * @class APIv2 |
40 | - * @extends {APIv3} |
41 | - * |
42 | - * This class inherits from the v3 version of the API so that removing v2 |
43 | - * once it is no longer needed will be easy (just delete this class, the one |
44 | - * or two places it is referenced in the code, and its associated tests). |
45 | - * |
46 | - */ |
47 | - ns.APIv2 = Y.Base.create('APIv2', ns.APIv3, [], { |
48 | - _apiRoot: 'api/2', |
49 | - |
50 | - /** |
51 | - * API call to fetch autocomplete suggestions based on the current term. |
52 | - * |
53 | - * @method autocomplete |
54 | - * @param {Object} query the filters data object for search. |
55 | - * @param {Object} filters the filters data object for search. |
56 | - * @param {Object} callbacks the success/failure callbacks to use. |
57 | - * @param {Object} bindScope the scope of *this* in the callbacks. |
58 | - */ |
59 | - autocomplete: function(filters, callbacks, bindScope) { |
60 | - var endpoint = 'charms'; |
61 | - // Force that this is an autocomplete call to perform matching on the |
62 | - // start of names vs a fulltext search. |
63 | - filters.autocomplete = 'true'; |
64 | - filters.limit = 5; |
65 | - if (bindScope) { |
66 | - callbacks.success = Y.bind(callbacks.success, bindScope); |
67 | - callbacks.failure = Y.bind(callbacks.failure, bindScope); |
68 | - } |
69 | - this._makeRequest(endpoint, callbacks, filters); |
70 | - }, |
71 | - |
72 | - /** |
73 | - * API call to fetch a charm's details, with an optional local cache. |
74 | - * |
75 | - * @method charmWithCache |
76 | - * @param {String} charmID The charm to fetch This is the fully qualified |
77 | - * charm name in the format scheme:series/charm-revision. |
78 | - * @param {Object} callbacks The success/failure callbacks to use. |
79 | - * @param {Object} bindScope The scope of "this" in the callbacks. |
80 | - * @param {ModelList} [cache] a local cache of browser charms. |
81 | - * @param {String} [defaultSeries='precise'] The series to use if none is |
82 | - * specified in the charm ID. |
83 | - */ |
84 | - charm: function(charmID, callbacks, bindScope, cache, defaultSeries) { |
85 | - if (bindScope) { |
86 | - callbacks.success = Y.bind(callbacks.success, bindScope); |
87 | - } |
88 | - if (cache) { |
89 | - var charm = cache.getById(charmID); |
90 | - if (charm) { |
91 | - // If the charm was found in the cache, then we can declare success |
92 | - // without ever making a request to charmworld. |
93 | - Y.soon(function() { |
94 | - // Since there wasn't really a request, there is no data, so we |
95 | - // pass an empty object as the "data" parameter. |
96 | - callbacks.success({}, charm); |
97 | - }); |
98 | - return; |
99 | - } else { |
100 | - var successCB = callbacks.success; |
101 | - callbacks.success = function(data) { |
102 | - var charm = new Y.juju.models.Charm(data.charm); |
103 | - if (data.metadata) { |
104 | - charm.set('metadata', data.metadata); |
105 | - } |
106 | - cache.add(charm); |
107 | - successCB(data, charm); |
108 | - }; |
109 | - } |
110 | - } |
111 | - charmID = this.apiHelper.normalizeCharmId(charmID, defaultSeries); |
112 | - // If the charm ID does not have a revision number (or "HEAD"), add one. |
113 | - if (/\-(\d+|HEAD)/.exec(charmID) === null) { |
114 | - // Add in a revision placeholder. Any value will do, v2 of the |
115 | - // charmworld API ignores revision numbers. |
116 | - charmID = charmID + '-1'; |
117 | - } |
118 | - this._charm(charmID, callbacks, bindScope); |
119 | - }, |
120 | - |
121 | - /** |
122 | - Promises to return the latest charm ID for a given charm if a newer one |
123 | - exists; this also caches the newer charm if one is available. |
124 | - |
125 | - @method promiseUpgradeAvailability |
126 | - @param {Charm} charm An existing charm potentially in need of an upgrade. |
127 | - @param {ModelList} cache A local cache of browser charms. |
128 | - @return {Promise} A promise for a newer charm ID or undefined. |
129 | - */ |
130 | - promiseUpgradeAvailability: function(charm, cache) { |
131 | - // Get the charm's store ID, then replace the version number |
132 | - // with '-HEAD' to retrieve the latest version of the charm. |
133 | - var storeId, revision; |
134 | - if (charm instanceof Y.Model) { |
135 | - storeId = charm.get('storeId'); |
136 | - revision = parseInt(charm.get('revision'), 10); |
137 | - } else { |
138 | - storeId = charm.url; |
139 | - revision = parseInt(charm.revision, 10); |
140 | - } |
141 | - storeId = storeId.replace(/-\d+$/, '-HEAD'); |
142 | - // XXX By using a cache we hide charm versions that have become available |
143 | - // since we last requested the most recent version. |
144 | - return this.promiseCharm(storeId, cache) |
145 | - .then(function(latest) { |
146 | - var latestVersion = parseInt(latest.charm.id.split('-').pop(), 10); |
147 | - if (latestVersion > revision) { |
148 | - return latest.charm.id; |
149 | - } |
150 | - }, function(e) { |
151 | - throw e; |
152 | - }); |
153 | - }, |
154 | - |
155 | - /** |
156 | - * API call to search charms |
157 | - * |
158 | - * @method search |
159 | - * @param {Object} filters the filters data object for search. |
160 | - * @param {Object} callbacks the success/failure callbacks to use. |
161 | - * @param {Object} bindScope the scope of *this* in the callbacks. |
162 | - */ |
163 | - search: function(filters, callbacks, bindScope) { |
164 | - var endpoint = 'charms'; |
165 | - if (bindScope) { |
166 | - callbacks.success = Y.bind(callbacks.success, bindScope); |
167 | - callbacks.failure = Y.bind(callbacks.failure, bindScope); |
168 | - } |
169 | - this._makeRequest(endpoint, callbacks, filters); |
170 | - }, |
171 | - |
172 | - /** |
173 | - Generate the API path to a charm icon. |
174 | - This is useful when generating links and references in HTML to the |
175 | - charm's icon and is constructing the correct icon based on reviewed |
176 | - status and categories on the charm. |
177 | - |
178 | - @method iconpath |
179 | - @param {String} charmID The id of the charm to grab the icon for. |
180 | - @return {String} The URL of the charm's icon. |
181 | - */ |
182 | - iconpath: function(charmID) { |
183 | - // If this is a local charm, then we need use a hard coded path to the |
184 | - // default icon since we cannot fetch its category data or its own |
185 | - // icon. |
186 | - // XXX: #1202703 - this is a short term fix for the bug. Need longer |
187 | - // term solution. |
188 | - if (charmID.indexOf('local:') === 0) { |
189 | - return this.get('apiHost') + |
190 | - 'static/img/charm_160.svg'; |
191 | - |
192 | - } else { |
193 | - // Get the charm ID from the service. In some cases, this will be |
194 | - // the charm URL with a protocol, which will need to be removed. |
195 | - // The following regular expression removes everything up to the |
196 | - // colon portion of the quote and leaves behind a charm ID. |
197 | - charmID = charmID.replace(/^[^:]+:/, ''); |
198 | - return this.get('apiHost') + [ |
199 | - this._apiRoot, |
200 | - 'charm', |
201 | - charmID, |
202 | - 'icon.svg'].join('/'); |
203 | - } |
204 | - }, |
205 | - |
206 | - /** |
207 | - * Given a result list, turn that into an array of charm objects for the |
208 | - * application to use. Metadata is appended to the charm or bundle as the |
209 | - * 'metadata' attribute. |
210 | - * |
211 | - * @method transformResults |
212 | - * @param {Object} JSON decoded data from response. |
213 | - * @return {Array} List of charm objects. |
214 | - * |
215 | - */ |
216 | - transformResults: function(data) { |
217 | - // Remove non-charms (bundles) from the data. |
218 | - data = Y.Array.filter(data, function(charmData) { |
219 | - return Y.Lang.isValue(charmData.charm); |
220 | - }); |
221 | - // Append the metadata to the actual charm object. |
222 | - data = Y.Array.map(data, function(charmData) { |
223 | - var charm = new Y.juju.models.Charm(charmData.charm); |
224 | - if (charmData.metadata) { |
225 | - charm.set('metadata', charmData.metadata); |
226 | - } |
227 | - return charm; |
228 | - }); |
229 | - return data; |
230 | - }, |
231 | - |
232 | - /** |
233 | - * Fetch the interesting landing content from the charmworld API. |
234 | - * |
235 | - * @method interesting |
236 | - * @return {Object} data loaded from the API call. |
237 | - * |
238 | - */ |
239 | - interesting: function(callbacks, bindScope) { |
240 | - if (bindScope) { |
241 | - callbacks.success = Y.bind(callbacks.success, bindScope); |
242 | - callbacks.failure = Y.bind(callbacks.failure, bindScope); |
243 | - } |
244 | - |
245 | - this._makeRequest('charms/interesting', callbacks); |
246 | - } |
247 | - }, { |
248 | - ATTRS: {} |
249 | - }); |
250 | - |
251 | }, '0.1.0', { |
252 | requires: [ |
253 | 'datasource-io', |
254 | |
255 | === modified file 'app/subapps/browser/browser.js' |
256 | --- app/subapps/browser/browser.js 2013-10-30 11:59:48 +0000 |
257 | +++ app/subapps/browser/browser.js 2013-11-05 18:17:46 +0000 |
258 | @@ -1112,7 +1112,7 @@ |
259 | |
260 | /** |
261 | @attribute store |
262 | - @default juju.charmworld.APIv2 |
263 | + @default juju.charmworld.APIv3 |
264 | @type {Object} |
265 | */ |
266 | store: {}, |
267 | |
268 | === modified file 'app/views/topology/bundle.js' |
269 | --- app/views/topology/bundle.js 2013-11-01 18:12:36 +0000 |
270 | +++ app/views/topology/bundle.js 2013-11-05 18:17:46 +0000 |
271 | @@ -371,7 +371,7 @@ |
272 | } |
273 | this.store = options.store; |
274 | if (!this.store) { |
275 | - this.store = new juju.charmworld.APIv2({}); |
276 | + this.store = new juju.charmworld.APIv3({}); |
277 | this._cleanups.push(this.store.destroy); |
278 | } |
279 | this.container = options.container; |
280 | |
281 | === modified file 'test/test_app.js' |
282 | --- test/test_app.js 2013-09-27 15:46:09 +0000 |
283 | +++ test/test_app.js 2013-11-05 18:17:46 +0000 |
284 | @@ -514,7 +514,7 @@ |
285 | consoleEnabled: true, |
286 | user: 'admin', |
287 | password: 'admin', |
288 | - store: new Y.juju.charmworld.APIv2({}) |
289 | + store: new Y.juju.charmworld.APIv3({}) |
290 | }); |
291 | app.showView(new Y.View()); |
292 | // This simply walks through the hierarchy to show that all the |
293 | |
294 | === modified file 'test/test_browser_app.js' |
295 | --- test/test_browser_app.js 2013-10-30 13:23:16 +0000 |
296 | +++ test/test_browser_app.js 2013-11-05 18:17:46 +0000 |
297 | @@ -75,7 +75,7 @@ |
298 | it('must correctly render the initial browser ui', function() { |
299 | var container = Y.one('#subapp-browser'); |
300 | view = new FullScreen({ |
301 | - store: new Y.juju.charmworld.APIv2({ |
302 | + store: new Y.juju.charmworld.APIv3({ |
303 | apiHost: 'http://localhost' |
304 | }) |
305 | }); |
306 | @@ -108,7 +108,7 @@ |
307 | |
308 | it('must show the home icons when withHome is set', function() { |
309 | var container = Y.one('#subapp-browser'), |
310 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
311 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
312 | |
313 | view = new FullScreen({ |
314 | store: fakeStore, |
315 | @@ -122,7 +122,7 @@ |
316 | |
317 | it('shows the home icons if the withHome is changed', function(done) { |
318 | var container = Y.one('#subapp-browser'), |
319 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
320 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
321 | |
322 | view = new FullScreen({ |
323 | store: fakeStore |
324 | @@ -140,7 +140,7 @@ |
325 | |
326 | it('routes home when it catches a gohome event', function(done) { |
327 | var container = Y.one('#subapp-browser'), |
328 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
329 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
330 | view = new FullScreen({ |
331 | store: fakeStore |
332 | }); |
333 | @@ -159,7 +159,7 @@ |
334 | |
335 | it('resets charmid and hash on search', function(done) { |
336 | var container = Y.one('#subapp-browser'), |
337 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
338 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
339 | view = new FullScreen({ |
340 | charmID: 'precise/jenkins-13' |
341 | }); |
342 | @@ -179,7 +179,7 @@ |
343 | |
344 | it('picks up the search widget deploy event', function(done) { |
345 | var container = utils.makeContainer('subapp-browser'), |
346 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
347 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
348 | view = new FullScreen({ |
349 | charmID: 'precise/jenkins-13', |
350 | store: fakeStore |
351 | @@ -300,7 +300,7 @@ |
352 | var container = Y.one('#subapp-browser'); |
353 | view = new Sidebar({ |
354 | container: container, |
355 | - store: new Y.juju.charmworld.APIv2({ |
356 | + store: new Y.juju.charmworld.APIv3({ |
357 | apiHost: 'http://localhost' |
358 | }) |
359 | }); |
360 | @@ -343,7 +343,7 @@ |
361 | it('shows the home icon when instructed', function() { |
362 | var container = Y.one('#subapp-browser'); |
363 | view = new Sidebar({ |
364 | - store: new Y.juju.charmworld.APIv2({ |
365 | + store: new Y.juju.charmworld.APIv3({ |
366 | apiHost: 'http://localhost' |
367 | }), |
368 | withHome: true |
369 | @@ -374,7 +374,7 @@ |
370 | |
371 | it('routes home when it catches a gohome event', function(done) { |
372 | var container = Y.one('#subapp-browser'), |
373 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
374 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
375 | view = new Sidebar({ |
376 | store: fakeStore |
377 | }); |
378 | @@ -392,7 +392,7 @@ |
379 | |
380 | it('picks up the search widget deploy event', function(done) { |
381 | var container = utils.makeContainer('subapp-browser'), |
382 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
383 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
384 | view = new Sidebar({ |
385 | charmID: 'precise/jenkins-13', |
386 | store: fakeStore |
387 | @@ -424,7 +424,7 @@ |
388 | 'juju-views', |
389 | 'subapp-browser', function(Y) { |
390 | browser = Y.namespace('juju.subapps'); |
391 | - CharmworldAPI = Y.namespace('juju').charmworld.APIv2; |
392 | + CharmworldAPI = Y.namespace('juju').charmworld.APIv3; |
393 | next = function() {}; |
394 | done(); |
395 | }); |
396 | |
397 | === modified file 'test/test_browser_charm_details.js' |
398 | --- test/test_browser_charm_details.js 2013-10-30 13:23:16 +0000 |
399 | +++ test/test_browser_charm_details.js 2013-11-05 18:17:46 +0000 |
400 | @@ -141,7 +141,7 @@ |
401 | }); |
402 | |
403 | it('has sharing links', function() { |
404 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
405 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
406 | fakeStore.set('datasource', { |
407 | sendRequest: function(params) { |
408 | // Stubbing the server callback value |
409 | @@ -278,7 +278,7 @@ |
410 | }); |
411 | |
412 | it('should be able to display the readme content', function() { |
413 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
414 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
415 | fakeStore.set('datasource', { |
416 | sendRequest: function(params) { |
417 | // Stubbing the server callback value |
418 | @@ -338,7 +338,7 @@ |
419 | |
420 | |
421 | it('_addCharmEnvironment displays the config panel', function(done) { |
422 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
423 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
424 | fakeStore.iconpath = function() { |
425 | return 'charm icon url'; |
426 | }; |
427 | @@ -368,7 +368,7 @@ |
428 | }); |
429 | |
430 | it('should load a file when a hook is selected', function() { |
431 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
432 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
433 | fakeStore.set('datasource', { |
434 | sendRequest: function(params) { |
435 | // Stubbing the server callback value |
436 | @@ -408,7 +408,7 @@ |
437 | }); |
438 | |
439 | it('should be able to render markdown as html', function() { |
440 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
441 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
442 | fakeStore.set('datasource', { |
443 | sendRequest: function(params) { |
444 | // Stubbing the server callback value |
445 | @@ -516,7 +516,7 @@ |
446 | data.scores = null; |
447 | var fakedata = Y.JSON.stringify(data); |
448 | |
449 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
450 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
451 | fakeStore.set('datasource', { |
452 | sendRequest: function(params) { |
453 | // Stubbing the server callback value |
454 | @@ -864,7 +864,7 @@ |
455 | // We don't want any files so we don't have to mock/load them. |
456 | data.files = []; |
457 | |
458 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
459 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
460 | fakeStore.set('datasource', { |
461 | sendRequest: function(params) { |
462 | // Stubbing the server callback value |
463 | @@ -910,7 +910,7 @@ |
464 | // We don't want any files so we don't have to mock/load them. |
465 | data.files = []; |
466 | |
467 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
468 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
469 | fakeStore.set('datasource', { |
470 | sendRequest: function(params) { |
471 | // Stubbing the server callback value |
472 | @@ -945,7 +945,7 @@ |
473 | // We don't want any files so we don't have to mock/load them. |
474 | data.files = []; |
475 | |
476 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
477 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
478 | fakeStore.set('datasource', { |
479 | sendRequest: function(params) { |
480 | // Stubbing the server callback value |
481 | @@ -996,7 +996,7 @@ |
482 | // We don't want any files so we don't have to mock/load them. |
483 | data.files = []; |
484 | |
485 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
486 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
487 | fakeStore.set('datasource', { |
488 | sendRequest: function(params) { |
489 | // Stubbing the server callback value. |
490 | |
491 | === modified file 'test/test_browser_editorial.js' |
492 | --- test/test_browser_editorial.js 2013-09-30 22:59:57 +0000 |
493 | +++ test/test_browser_editorial.js 2013-11-05 18:17:46 +0000 |
494 | @@ -72,7 +72,7 @@ |
495 | }); |
496 | |
497 | it('renders sidebar with hidden charms', function() { |
498 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
499 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
500 | fakeStore.set('datasource', { |
501 | sendRequest: function(params) { |
502 | // Stubbing the server callback value |
503 | @@ -93,7 +93,7 @@ |
504 | |
505 | it('shows and hides an indicator', function(done) { |
506 | var hit = 0; |
507 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
508 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
509 | fakeStore.set('datasource', { |
510 | sendRequest: function(params) { |
511 | // Stubbing the server callback value |
512 | @@ -120,7 +120,7 @@ |
513 | }); |
514 | |
515 | it('renders fullscreen 14/22 charms hidden', function() { |
516 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
517 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
518 | fakeStore.set('datasource', { |
519 | sendRequest: function(params) { |
520 | // Stubbing the server callback value |
521 | @@ -141,7 +141,7 @@ |
522 | }); |
523 | |
524 | it('clicking a charm navigates for fullscreen', function(done) { |
525 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
526 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
527 | fakeStore.set('datasource', { |
528 | sendRequest: function(params) { |
529 | // Stubbing the server callback value |
530 | @@ -169,7 +169,7 @@ |
531 | }); |
532 | |
533 | it('clicking a charm navigates for sidebar', function(done) { |
534 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
535 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
536 | fakeStore.set('datasource', { |
537 | sendRequest: function(params) { |
538 | // Stubbing the server callback value |
539 | @@ -196,7 +196,7 @@ |
540 | }); |
541 | |
542 | it('setting the activeID marks the div active', function() { |
543 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
544 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
545 | fakeStore.set('datasource', { |
546 | sendRequest: function(params) { |
547 | // Stubbing the server callback value |
548 | @@ -217,7 +217,7 @@ |
549 | }); |
550 | |
551 | it('unsetting the activeID will remove the active markings', function() { |
552 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
553 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
554 | fakeStore.set('datasource', { |
555 | sendRequest: function(params) { |
556 | // Stubbing the server callback value |
557 | @@ -255,7 +255,7 @@ |
558 | }); |
559 | |
560 | it('uses passed in cache data if available', function() { |
561 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
562 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
563 | fakeStore.set('datasource', { |
564 | sendRequest: function(params) { |
565 | // Stubbing the server callback value |
566 | |
567 | === modified file 'test/test_browser_search_view.js' |
568 | --- test/test_browser_search_view.js 2013-09-30 20:57:01 +0000 |
569 | +++ test/test_browser_search_view.js 2013-11-05 18:17:46 +0000 |
570 | @@ -53,7 +53,7 @@ |
571 | // |
572 | // Create monkeypatched store to verify right method is called. |
573 | apiURL = ''; |
574 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
575 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
576 | var sampleData = { |
577 | result: [{ |
578 | charm: { |
579 | @@ -98,7 +98,7 @@ |
580 | it('renders correctly', function() { |
581 | view.render(); |
582 | var container = view.get('container'); |
583 | - assert.equal('charms?text=foo', apiURL); |
584 | + assert.equal('search?text=foo', apiURL); |
585 | assert.equal(1, container.all('.yui3-token').size()); |
586 | var charmText = container.one('.yui3-token').one('.title').get('text'); |
587 | assert.equal(charmText.replace(/\s+/g, ''), 'bar'); |
588 | @@ -121,7 +121,7 @@ |
589 | it('handles empty text for search', function() { |
590 | view.set('filters', {text: ''}); |
591 | view.render(); |
592 | - assert.equal('charms?text=', apiURL); |
593 | + assert.equal('search?text=', apiURL); |
594 | }); |
595 | |
596 | it('clicking a charm navigates for fullscreen', function(done) { |
597 | @@ -161,7 +161,7 @@ |
598 | } |
599 | }] |
600 | }; |
601 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
602 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
603 | fakeStore.set('datasource', { |
604 | sendRequest: function(params) { |
605 | // Stubbing the server callback value |
606 | @@ -204,7 +204,7 @@ |
607 | } |
608 | }] |
609 | }; |
610 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
611 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
612 | fakeStore.set('datasource', { |
613 | sendRequest: function(params) { |
614 | // Stubbing the server callback value |
615 | @@ -291,7 +291,7 @@ |
616 | } |
617 | }] |
618 | }; |
619 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
620 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
621 | fakeStore.set('datasource', { |
622 | sendRequest: function(params) { |
623 | // Stubbing the server callback value |
624 | |
625 | === modified file 'test/test_browser_search_widget.js' |
626 | --- test/test_browser_search_widget.js 2013-11-04 16:40:41 +0000 |
627 | +++ test/test_browser_search_widget.js 2013-11-05 18:17:46 +0000 |
628 | @@ -223,7 +223,7 @@ |
629 | cleanIconHelper = utils.stubCharmIconPath(); |
630 | |
631 | // We need a valid store instance to send back the data. |
632 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
633 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
634 | fakeStore.set('datasource', { |
635 | sendRequest: function(params) { |
636 | // Stubbing the server callback value |
637 | |
638 | === modified file 'test/test_bundle_details_view.js' |
639 | --- test/test_bundle_details_view.js 2013-11-01 17:39:04 +0000 |
640 | +++ test/test_bundle_details_view.js 2013-11-05 18:17:46 +0000 |
641 | @@ -68,7 +68,7 @@ |
642 | container = utils.makeContainer(); |
643 | container.append('<div class="bws-view-data"></div>'); |
644 | var defaults = { |
645 | - store: utils.makeFakeStore(3), |
646 | + store: utils.makeFakeStore(), |
647 | db: {}, |
648 | entityId: data.id, |
649 | renderTo: container |
650 | |
651 | === modified file 'test/test_charmworld.js' |
652 | --- test/test_charmworld.js 2013-10-08 23:15:39 +0000 |
653 | +++ test/test_charmworld.js 2013-11-05 18:17:46 +0000 |
654 | @@ -248,7 +248,7 @@ |
655 | }); |
656 | |
657 | it('finds upgrades for charms - upgrade available', function(done) { |
658 | - var store = utils.makeFakeStore(3); |
659 | + var store = utils.makeFakeStore(); |
660 | var charm = new models.Charm({url: 'cs:precise/wordpress-10'}); |
661 | store.promiseUpgradeAvailability(charm) |
662 | .then(function(upgrade) { |
663 | @@ -261,7 +261,7 @@ |
664 | }); |
665 | |
666 | it('finds upgrades for charms - no upgrade available', function(done) { |
667 | - var store = utils.makeFakeStore(3); |
668 | + var store = utils.makeFakeStore(); |
669 | var charm = new models.Charm({url: 'cs:precise/wordpress-15'}); |
670 | store.promiseUpgradeAvailability(charm) |
671 | .then(function(upgrade) { |
672 | @@ -274,7 +274,7 @@ |
673 | }); |
674 | |
675 | it('copies metadata while transforming results', function() { |
676 | - var store = utils.makeFakeStore(3); |
677 | + var store = utils.makeFakeStore(); |
678 | var fakebundle = {bundle: {id: 'bundle0'}, |
679 | metadata: 'bundledata'}; |
680 | var fakecharm = {charm: {url: 'cs:precise/wordpress-15'}, |
681 | @@ -295,266 +295,6 @@ |
682 | |
683 | }); |
684 | |
685 | - // The tests below are based on copies of the v3 tests above so that removing |
686 | - // support for the v2 charmworld API will be easy. However, it means that |
687 | - // any edits made to these tests may need to be made to the v3 tests above. |
688 | - describe('Charmworld API v2 interface', function() { |
689 | - var Y, models, conn, data, juju, utils, charmworld, |
690 | - hostname, api; |
691 | - |
692 | - |
693 | - before(function(done) { |
694 | - Y = YUI(GlobalConfig).use( |
695 | - 'datasource-local', 'json-stringify', 'juju-charm-store', |
696 | - 'datasource-io', 'io', 'array-extras', 'juju-charm-models', |
697 | - 'juju-tests-utils', |
698 | - function(Y) { |
699 | - juju = Y.namespace('juju'); |
700 | - charmworld = Y.namespace('juju.charmworld'); |
701 | - models = Y.namespace('juju.models'); |
702 | - utils = Y.namespace('juju-tests').utils; |
703 | - done(); |
704 | - }); |
705 | - }); |
706 | - |
707 | - beforeEach(function() { |
708 | - hostname = 'http://charmworld.example/'; |
709 | - api = new charmworld.APIv2({apiHost: hostname}); |
710 | - }); |
711 | - |
712 | - it('constructs the api url correctly based on apiHost', function() { |
713 | - var ds = api.get('datasource'); |
714 | - |
715 | - ds.get('source').should.eql(hostname + 'api/2/'); |
716 | - |
717 | - // And it should work without a trailing / as well. |
718 | - hostname = hostname.slice(0, -1); |
719 | - api = new charmworld.APIv2({apiHost: hostname}); |
720 | - ds = api.get('datasource'); |
721 | - ds.get('source').should.eql(hostname + '/api/2/'); |
722 | - }); |
723 | - |
724 | - it('handles loading interesting content correctly', function(done) { |
725 | - var data = []; |
726 | - |
727 | - data.push({responseText: Y.JSON.stringify({summary: 'wowza'})}); |
728 | - api.set('datasource', new Y.DataSource.Local({source: data})); |
729 | - |
730 | - api.interesting({ |
731 | - success: function(data) { |
732 | - data.summary.should.equal('wowza'); |
733 | - done(); |
734 | - }, |
735 | - failure: function(data, request) { |
736 | - } |
737 | - }, this); |
738 | - |
739 | - }); |
740 | - |
741 | - it('handles searching correctly', function(done) { |
742 | - var data = [], |
743 | - url; |
744 | - data.push({responseText: Y.JSON.stringify({name: 'foo'})}); |
745 | - // Create a monkeypatched datasource we can use to track the generated |
746 | - // apiEndpoint |
747 | - var datasource = new Y.DataSource.Local({source: data}); |
748 | - datasource.realSendRequest = datasource.sendRequest; |
749 | - datasource.sendRequest = function(params) { |
750 | - url = params.request; |
751 | - datasource.realSendRequest(params); |
752 | - }; |
753 | - |
754 | - api.set('datasource', datasource); |
755 | - api.search({text: 'foo'}, { |
756 | - success: function(data) { |
757 | - assert.equal('charms?text=foo', url); |
758 | - assert.equal('foo', data.name); |
759 | - done(); |
760 | - }, |
761 | - failure: function(data, request) { |
762 | - } |
763 | - }, this); |
764 | - api.destroy(); |
765 | - }); |
766 | - |
767 | - it('constructs cateogry icon paths correctly', function() { |
768 | - var iconPath = api.buildCategoryIconPath('app-servers'); |
769 | - assert.equal( |
770 | - iconPath, |
771 | - hostname + 'static/img/category-app-servers-bw.svg'); |
772 | - }); |
773 | - |
774 | - it('makes charm requests to correct URL', function(done) { |
775 | - api._makeRequest = function(endpoint, callbacks, filters) { |
776 | - assert.equal(endpoint, 'charm/CHARM-ID'); |
777 | - done(); |
778 | - }; |
779 | - |
780 | - api._charm('CHARM-ID'); |
781 | - }); |
782 | - |
783 | - it('can use a cache to avoid requesting charm data', function(done) { |
784 | - var should_not_happen = function() { |
785 | - assert.isTrue(false, 'Oops, this should not have been called.'); |
786 | - done(); |
787 | - }; |
788 | - var CACHED_CHARM = 'CACHED-CHARM'; |
789 | - |
790 | - var callbacks = { |
791 | - success: function(data, charm) { |
792 | - assert.equal(charm, CACHED_CHARM); |
793 | - done(); |
794 | - }, |
795 | - failure: should_not_happen |
796 | - }; |
797 | - |
798 | - api._makeRequest = should_not_happen; |
799 | - |
800 | - var cache = { |
801 | - getById: function(charmID) { |
802 | - return CACHED_CHARM; |
803 | - }}; |
804 | - |
805 | - api.charm('CHARM-ID', callbacks, false, cache); |
806 | - |
807 | - }); |
808 | - |
809 | - it('will make a request on a cache miss', function(done) { |
810 | - var should_not_happen = function() { |
811 | - assert.isTrue(false, 'Oops, this should not have been called.'); |
812 | - done(); |
813 | - }; |
814 | - var CACHED_CHARM = 'CACHED-CHARM'; |
815 | - |
816 | - var callbacks = { |
817 | - success: function(data, charm) { |
818 | - assert.equal(charm, CACHED_CHARM); |
819 | - done(); |
820 | - }, |
821 | - failure: should_not_happen |
822 | - }; |
823 | - |
824 | - api._makeRequest = function() { |
825 | - // If this was called, then the test is successful. |
826 | - done(); |
827 | - }; |
828 | - |
829 | - var cache = { |
830 | - getById: function(charmID) { |
831 | - return null; |
832 | - }}; |
833 | - |
834 | - api.charm('CHARM-ID', callbacks, false, cache); |
835 | - |
836 | - }); |
837 | - |
838 | - it('makes autocomplete requests to correct URL', function(done) { |
839 | - var noop = function() {}; |
840 | - |
841 | - api._makeRequest = function(endpoint, callbacks, filters) { |
842 | - assert.equal(endpoint, 'charms'); |
843 | - done(); |
844 | - }; |
845 | - |
846 | - api.autocomplete({text: 'mys'}, {'success': noop}); |
847 | - }); |
848 | - |
849 | - it('makes autocomplete requests with right query flag', function(done) { |
850 | - var noop = function() {}; |
851 | - |
852 | - api._makeRequest = function(endpoint, callbacks, filters) { |
853 | - assert.equal(filters.autocomplete, 'true'); |
854 | - done(); |
855 | - }; |
856 | - |
857 | - api.autocomplete({text: 'mys'}, {'success': noop}); |
858 | - }); |
859 | - |
860 | - it('constructs iconpaths correctly', function() { |
861 | - var iconPath = api.iconpath('precise/mysql-1'); |
862 | - assert.equal(iconPath, hostname + 'api/2/charm/precise/mysql-1/icon.svg'); |
863 | - }); |
864 | - |
865 | - it('constructs an icon path for local charms', function() { |
866 | - var iconPath = api.iconpath('local:precise/mysql-1'); |
867 | - assert.equal(iconPath, hostname + 'static/img/charm_160.svg'); |
868 | - }); |
869 | - |
870 | - it('splits the charm id to remove cs: when necessary', function() { |
871 | - var iconPath = api.iconpath('cs:precise/mysql-1'); |
872 | - assert.equal(iconPath, hostname + 'api/2/charm/precise/mysql-1/icon.svg'); |
873 | - }); |
874 | - |
875 | - it('can fetch a charm via a promise', function(done) { |
876 | - // The "promiseCharm" method is just a promise-wrapped version of the |
877 | - // "charm" method. |
878 | - var DATA = 'DATA'; |
879 | - var CHARM = 'CHARM'; |
880 | - api.charm = function(charmID, callbacks) { |
881 | - callbacks.success(DATA, CHARM); |
882 | - }; |
883 | - api.promiseCharm('CHARM-ID', null, 'precise') |
884 | - .then(function(data) { |
885 | - assert.equal(data, DATA); |
886 | - done(); |
887 | - }); |
888 | - }); |
889 | - |
890 | - it('finds upgrades for charms - upgrade available', function(done) { |
891 | - var store = utils.makeFakeStore(); |
892 | - var charm = new models.Charm({url: 'cs:precise/wordpress-10'}); |
893 | - store.promiseUpgradeAvailability(charm) |
894 | - .then(function(upgrade) { |
895 | - assert.equal(upgrade, 'precise/wordpress-15'); |
896 | - done(); |
897 | - }, function(error) { |
898 | - assert.isTrue(false, 'We should not get here.'); |
899 | - done(); |
900 | - }); |
901 | - }); |
902 | - |
903 | - it('finds upgrades for charms - no upgrade available', function(done) { |
904 | - var store = utils.makeFakeStore(); |
905 | - var charm = new models.Charm({url: 'cs:precise/wordpress-15'}); |
906 | - store.promiseUpgradeAvailability(charm) |
907 | - .then(function(upgrade) { |
908 | - assert.isUndefined(upgrade); |
909 | - done(); |
910 | - }, function(error) { |
911 | - assert.isTrue(false, 'We should not get here'); |
912 | - done(); |
913 | - }); |
914 | - }); |
915 | - |
916 | - it('filters results into an array of charms while removing bundles', |
917 | - function() { |
918 | - var store = utils.makeFakeStore(); |
919 | - var fakecharm = {charm: {url: 'cs:precise/wordpress-15'}}; |
920 | - var fakebundle = {bundle: {id: 'bundle0'}}; |
921 | - var other = {foo: {id: 'foo0'}}; |
922 | - var results = store.transformResults([fakecharm, fakebundle, other]); |
923 | - var expected = [new models.Charm(fakecharm.charm)]; |
924 | - assert.equal(expected.length, results.length); |
925 | - assert.equal(expected[0].get('id'), results[0].get('id')); |
926 | - }); |
927 | - |
928 | - it('copies metadata while transforming results', function() { |
929 | - var store = utils.makeFakeStore(); |
930 | - var fakebundle = {bundle: {id: 'bundle0'}, |
931 | - metadata: 'bundledata'}; |
932 | - var fakecharm = {charm: {url: 'cs:precise/wordpress-15'}, |
933 | - metadata: 'charmdata'}; |
934 | - var testdata = Y.clone([fakecharm, fakebundle]); |
935 | - fakebundle.bundle.metadata = fakebundle.metadata; |
936 | - fakecharm.charm.metadata = fakecharm.metadata; |
937 | - var expected = [new models.Charm(fakecharm.charm)]; |
938 | - var results = store.transformResults(testdata); |
939 | - assert.equal(expected.length, results.length); |
940 | - assert.equal(expected[0].get('id'), results[0].get('id')); |
941 | - assert.equal(expected[0].get('metadata'), results[0].get('metadata')); |
942 | - }); |
943 | - }); |
944 | - |
945 | describe('Charmworld API Helper', function() { |
946 | var Y, models, conn, data, juju, utils, charmworld, hostname; |
947 | |
948 | @@ -602,39 +342,4 @@ |
949 | |
950 | }); |
951 | |
952 | - describe('Charmworld API feature flag support', function() { |
953 | - var Y, models, conn, juju, app; |
954 | - |
955 | - |
956 | - before(function(done) { |
957 | - Y = YUI(GlobalConfig).use( |
958 | - 'juju-gui', |
959 | - 'datasource-local', 'json-stringify', 'juju-charm-store', |
960 | - 'datasource-io', 'io', 'array-extras', 'juju-charm-models', |
961 | - 'juju-tests-utils', |
962 | - function(Y) { |
963 | - juju = Y.namespace('juju'); |
964 | - done(); |
965 | - }); |
966 | - }); |
967 | - |
968 | - afterEach(function() { |
969 | - app.destroy(); |
970 | - window.flags = {}; |
971 | - }); |
972 | - |
973 | - it('enables the charmworld v2 API if not set', function() { |
974 | - assert.deepEqual(window.flags, {}); |
975 | - app = new Y.juju.App({}); |
976 | - assert.equal(app.get('store').name, 'APIv2'); |
977 | - }); |
978 | - |
979 | - it('enables the charmworld v3 API if set', function() { |
980 | - window.flags.charmworldv3 = true; |
981 | - app = new Y.juju.App({}); |
982 | - assert.equal(app.get('store').name, 'APIv3'); |
983 | - }); |
984 | - |
985 | - }); |
986 | - |
987 | })(); |
988 | |
989 | === modified file 'test/test_environment_view.js' |
990 | --- test/test_environment_view.js 2013-10-24 20:48:42 +0000 |
991 | +++ test/test_environment_view.js 2013-11-05 18:17:46 +0000 |
992 | @@ -113,7 +113,7 @@ |
993 | env = juju.newEnvironment({conn: conn}); |
994 | env.connect(); |
995 | conn.open(); |
996 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
997 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
998 | fakeStore.iconpath = function() { |
999 | return 'charm icon url'; |
1000 | }; |
1001 | @@ -1207,7 +1207,7 @@ |
1002 | }); |
1003 | |
1004 | it('sets the default icon for local charms without an icon', function() { |
1005 | - var iconFakeStore = new Y.juju.charmworld.APIv2({ |
1006 | + var iconFakeStore = new Y.juju.charmworld.APIv3({ |
1007 | apiHost: 'http://localhost' |
1008 | }); |
1009 | var services = new models.ServiceList(); |
1010 | @@ -1244,7 +1244,7 @@ |
1011 | // The mysql charm has an icon from on the server. |
1012 | assert.equal( |
1013 | boxes['cs:mysql-1'].icon, |
1014 | - 'http://localhost/api/2/charm/mysql-1/icon.svg' |
1015 | + 'http://localhost/api/3/charm/mysql-1/file/icon.svg' |
1016 | ); |
1017 | }); |
1018 | }); |
1019 | |
1020 | === modified file 'test/test_ghost_inspector.js' |
1021 | --- test/test_ghost_inspector.js 2013-09-30 13:37:49 +0000 |
1022 | +++ test/test_ghost_inspector.js 2013-11-05 18:17:46 +0000 |
1023 | @@ -73,7 +73,7 @@ |
1024 | // Create a ghost service with the fake charm. |
1025 | service = db.services.ghostService(charm); |
1026 | |
1027 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
1028 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
1029 | fakeStore.iconpath = function(id) { |
1030 | return '/icon/' + id; |
1031 | }; |
1032 | |
1033 | === modified file 'test/test_inspector_charm.js' |
1034 | --- test/test_inspector_charm.js 2013-10-02 17:46:16 +0000 |
1035 | +++ test/test_inspector_charm.js 2013-11-05 18:17:46 +0000 |
1036 | @@ -62,7 +62,7 @@ |
1037 | testContainer = utils.makeContainer(); |
1038 | testContainer.setHTML('<div class="left-breakout"></div>'); |
1039 | |
1040 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
1041 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
1042 | fakeStore.set('datasource', { |
1043 | sendRequest: function(params) { |
1044 | // Stubbing the server callback value |
1045 | @@ -101,7 +101,7 @@ |
1046 | testContainer = utils.makeContainer(); |
1047 | testContainer.setHTML('<div class="left-breakout"></div>'); |
1048 | |
1049 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
1050 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
1051 | var cache = new Y.juju.models.CharmList(); |
1052 | var charm = new Y.juju.models.Charm(data.charm); |
1053 | charm.set('cached', true); |
1054 | |
1055 | === modified file 'test/test_inspector_constraints.js' |
1056 | --- test/test_inspector_constraints.js 2013-10-15 20:34:04 +0000 |
1057 | +++ test/test_inspector_constraints.js 2013-11-05 18:17:46 +0000 |
1058 | @@ -86,7 +86,7 @@ |
1059 | var conn = new utils.SocketStub(); |
1060 | var db = new models.Database(); |
1061 | var service = makeService(db); |
1062 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
1063 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
1064 | fakeStore.iconpath = function() { |
1065 | return 'charm icon url'; |
1066 | }; |
1067 | |
1068 | === modified file 'test/test_inspector_overview.js' |
1069 | --- test/test_inspector_overview.js 2013-11-05 03:23:33 +0000 |
1070 | +++ test/test_inspector_overview.js 2013-11-05 18:17:46 +0000 |
1071 | @@ -114,7 +114,7 @@ |
1072 | {id: 'mediawiki/2', agent_state: 'pending', |
1073 | charmUrl: 'cs:precise/mediaWiki-14'}] |
1074 | ]}}); |
1075 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
1076 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
1077 | fakeStore.iconpath = function(id) { |
1078 | return '/icon/' + id; |
1079 | }; |
1080 | |
1081 | === modified file 'test/test_inspector_settings.js' |
1082 | --- test/test_inspector_settings.js 2013-10-15 20:34:04 +0000 |
1083 | +++ test/test_inspector_settings.js 2013-11-05 18:17:46 +0000 |
1084 | @@ -92,7 +92,7 @@ |
1085 | ['unit', 'add', {id: 'mediawiki/2', agent_state: 'pending'}] |
1086 | ]}}); |
1087 | } |
1088 | - var fakeStore = new Y.juju.charmworld.APIv2({}); |
1089 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
1090 | fakeStore.iconpath = function() { |
1091 | return 'charm icon url'; |
1092 | }; |
1093 | |
1094 | === modified file 'test/test_model.js' |
1095 | --- test/test_model.js 2013-11-01 23:04:50 +0000 |
1096 | +++ test/test_model.js 2013-11-05 18:17:46 +0000 |
1097 | @@ -450,7 +450,7 @@ |
1098 | conn.open(); |
1099 | container = Y.Node.create('<div id="test" class="container"></div>'); |
1100 | data = []; |
1101 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
1102 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
1103 | fakeStore.set('datasource', { |
1104 | sendRequest: function(params) { |
1105 | params.callback.success({ |
1106 | |
1107 | === modified file 'test/test_service_module.js' |
1108 | --- test/test_service_module.js 2013-10-15 08:16:18 +0000 |
1109 | +++ test/test_service_module.js 2013-11-05 18:17:46 +0000 |
1110 | @@ -121,7 +121,7 @@ |
1111 | }); |
1112 | |
1113 | beforeEach(function() { |
1114 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
1115 | + fakeStore = new Y.juju.charmworld.APIv3({}); |
1116 | fakeStore.iconpath = function() { |
1117 | return 'charm icon url'; |
1118 | }; |
1119 | |
1120 | === modified file 'test/utils.js' |
1121 | --- test/utils.js 2013-11-01 23:04:50 +0000 |
1122 | +++ test/utils.js 2013-11-05 18:17:46 +0000 |
1123 | @@ -139,13 +139,8 @@ |
1124 | return charms; |
1125 | })(), |
1126 | |
1127 | - makeFakeStore: function(version) { |
1128 | - var fakeStore; |
1129 | - if (version === 3) { |
1130 | - fakeStore = new Y.juju.charmworld.APIv3({}); |
1131 | - } else { |
1132 | - fakeStore = new Y.juju.charmworld.APIv2({}); |
1133 | - } |
1134 | + makeFakeStore: function() { |
1135 | + var fakeStore = new Y.juju.charmworld.APIv3({}); |
1136 | fakeStore.charm = function(store_id, callbacks, bindscope, cache) { |
1137 | store_id = this.apiHelper.normalizeCharmId(store_id, 'precise'); |
1138 | var charmName = store_id.split('/')[1]; |
Reviewers: mp+193978_ code.launchpad. net,
Message:
Please take a look.
Description:
Remove charmworldv3 and APIv2
For QA, make sure that you can search for bundles (e.g., search for
hatch) and make sure that the charm store seems to be working correctly.
https:/ /code.launchpad .net/~gary/ juju-gui/ removeCharmworl dV3Flag/ +merge/ 193978
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/22000043/
Affected files (+61, -578 lines): charmworld. js browser/ browser. js topology/ bundle. js browser_ app.js browser_ charm_details. js browser_ editorial. js browser_ search_ view.js browser_ search_ widget. js bundle_ details_ view.js charmworld. js environment_ view.js ghost_inspector .js inspector_ charm.js inspector_ constraints. js inspector_ overview. js inspector_ settings. js service_ module. js
A [revision details]
M app/app.js
M app/store/
M app/subapps/
M app/views/
M test/test_app.js
M test/test_
M test/test_
M test/test_
M test/test_
M test/test_
M test/test_
M test/test_
M test/test_
M test/test_
M test/test_
M test/test_
M test/test_
M test/test_
M test/test_model.js
M test/test_
M test/utils.js