OLD | NEW |
1 /* | 1 /* |
2 This file is part of the Juju GUI, which lets users view and manage Juju | 2 This file is part of the Juju GUI, which lets users view and manage Juju |
3 environments within a graphical interface (https://launchpad.net/juju-gui). | 3 environments within a graphical interface (https://launchpad.net/juju-gui). |
4 Copyright (C) 2012-2013 Canonical Ltd. | 4 Copyright (C) 2012-2013 Canonical Ltd. |
5 | 5 |
6 This program is free software: you can redistribute it and/or modify it under | 6 This program is free software: you can redistribute it and/or modify it under |
7 the terms of the GNU Affero General Public License version 3, as published by | 7 the terms of the GNU Affero General Public License version 3, as published by |
8 the Free Software Foundation. | 8 the Free Software Foundation. |
9 | 9 |
10 This program is distributed in the hope that it will be useful, but WITHOUT | 10 This program is distributed in the hope that it will be useful, but WITHOUT |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 names = [ | 130 names = [ |
131 'wordpress', 'mysql', 'puppet', 'haproxy', 'mediawiki', 'hadoop', | 131 'wordpress', 'mysql', 'puppet', 'haproxy', 'mediawiki', 'hadoop', |
132 'memcached', 'puppetmaster']; | 132 'memcached', 'puppetmaster']; |
133 Y.Array.each(names, function(name) { | 133 Y.Array.each(names, function(name) { |
134 url = 'data/' + name + '-api-response.json'; | 134 url = 'data/' + name + '-api-response.json'; |
135 charms[name] = jujuTests.utils.loadFixture(url, true); | 135 charms[name] = jujuTests.utils.loadFixture(url, true); |
136 }); | 136 }); |
137 return charms; | 137 return charms; |
138 })(), | 138 })(), |
139 | 139 |
140 makeFakeStore: function(cache) { | 140 makeFakeStore: function(version) { |
141 var fakeStore = new Y.juju.charmworld.APIv2({}); | 141 var fakeStore; |
| 142 if (version === 3) { |
| 143 fakeStore = new Y.juju.charmworld.APIv3({}); |
| 144 } else { |
| 145 fakeStore = new Y.juju.charmworld.APIv2({}); |
| 146 } |
142 fakeStore.charm = function(store_id, callbacks, bindscope, cache) { | 147 fakeStore.charm = function(store_id, callbacks, bindscope, cache) { |
143 store_id = this.apiHelper.normalizeCharmId(store_id, 'precise'); | 148 store_id = this.apiHelper.normalizeCharmId(store_id, 'precise'); |
144 var charmName = store_id.split('/')[1]; | 149 var charmName = store_id.split('/')[1]; |
145 charmName = charmName.split('-', 1); | 150 charmName = charmName.split('-', 1); |
146 if (Y.Lang.isArray(charmName)) { | 151 if (Y.Lang.isArray(charmName)) { |
147 charmName = charmName[0]; | 152 charmName = charmName[0]; |
148 } | 153 } |
149 if (charmName in jujuTests.utils._cached_charms) { | 154 if (charmName in jujuTests.utils._cached_charms) { |
150 var response = jujuTests.utils._cached_charms[charmName]; | 155 var response = jujuTests.utils._cached_charms[charmName]; |
151 if (cache) { | 156 if (cache) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 'handlebars', | 209 'handlebars', |
205 'io', | 210 'io', |
206 'node', | 211 'node', |
207 'promise', | 212 'promise', |
208 'json-parse', | 213 'json-parse', |
209 'datasource-local', | 214 'datasource-local', |
210 'juju-charm-store', | 215 'juju-charm-store', |
211 'juju-env-fakebackend' | 216 'juju-env-fakebackend' |
212 ] | 217 ] |
213 }); | 218 }); |
OLD | NEW |