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 10 matching lines...) Expand all Loading... |
21 describe('Model Controller Promises', function() { | 21 describe('Model Controller Promises', function() { |
22 var modelController, yui, env, db, conn, environment, load, serviceError, | 22 var modelController, yui, env, db, conn, environment, load, serviceError, |
23 getService, cleanups, aEach, utils; | 23 getService, cleanups, aEach, utils; |
24 | 24 |
25 before(function(done) { | 25 before(function(done) { |
26 YUI(GlobalConfig).use( | 26 YUI(GlobalConfig).use( |
27 'juju-models', 'model-controller', 'juju-charm-models', | 27 'juju-models', 'model-controller', 'juju-charm-models', |
28 'juju-view-environment', 'juju-tests-utils', function(Y) { | 28 'juju-view-environment', 'juju-tests-utils', function(Y) { |
29 var environments = Y.juju.environments; | 29 var environments = Y.juju.environments; |
30 yui = Y; | 30 yui = Y; |
31 load = Y.juju.models.BrowserCharm.prototype.load; | 31 load = Y.juju.models.Charm.prototype.load; |
32 getService = environments.PythonEnvironment.prototype.get_service; | 32 getService = environments.PythonEnvironment.prototype.get_service; |
33 aEach = Y.Array.each; | 33 aEach = Y.Array.each; |
34 utils = Y.namespace('juju-tests.utils'); | 34 utils = Y.namespace('juju-tests.utils'); |
35 done(); | 35 done(); |
36 }); | 36 }); |
37 }); | 37 }); |
38 | 38 |
39 beforeEach(function() { | 39 beforeEach(function() { |
40 conn = new utils.SocketStub(); | 40 conn = new utils.SocketStub(); |
41 environment = env = yui.juju.newEnvironment( | 41 environment = env = yui.juju.newEnvironment( |
(...skipping 12 matching lines...) Expand all Loading... |
54 aEach([env, db, modelController], function(instance) { | 54 aEach([env, db, modelController], function(instance) { |
55 instance.destroy(); | 55 instance.destroy(); |
56 }); | 56 }); |
57 yui.Array.each(cleanups, function(cleanup) { | 57 yui.Array.each(cleanups, function(cleanup) { |
58 cleanup(); | 58 cleanup(); |
59 }); | 59 }); |
60 window.flags = {}; | 60 window.flags = {}; |
61 }); | 61 }); |
62 | 62 |
63 /** | 63 /** |
64 Monkeypatching the BrowserCharm model's load method to allow the load calls | 64 Monkeypatching the Charm model's load method to allow the load calls |
65 to execute successfully. | 65 to execute successfully. |
66 | 66 |
67 @method clobberLoad | 67 @method clobberLoad |
68 @static | 68 @static |
69 */ | 69 */ |
70 function clobberLoad() { | 70 function clobberLoad() { |
71 yui.juju.models.BrowserCharm.prototype.load = function(env, callback) { | 71 yui.juju.models.Charm.prototype.load = function(env, callback) { |
72 assert.deepEqual(env, environment); | 72 assert.deepEqual(env, environment); |
73 callback(); | 73 callback(); |
74 }; | 74 }; |
75 cleanups.push(restoreLoad); | 75 cleanups.push(restoreLoad); |
76 } | 76 } |
77 | 77 |
78 /** | 78 /** |
79 Restores the BrowserCharm model's load method to its original value. | 79 Restores the Charm model's load method to its original value. |
80 | 80 |
81 @method restoreLoad | 81 @method restoreLoad |
82 @static | 82 @static |
83 */ | 83 */ |
84 function restoreLoad() { | 84 function restoreLoad() { |
85 yui.juju.models.BrowserCharm.prototype.load = load; | 85 yui.juju.models.Charm.prototype.load = load; |
86 } | 86 } |
87 | 87 |
88 /** | 88 /** |
89 Monkeypatching the python environments get_service method to allow | 89 Monkeypatching the python environments get_service method to allow |
90 the get_service calls to execute successfully. | 90 the get_service calls to execute successfully. |
91 | 91 |
92 @method clobberGetService | 92 @method clobberGetService |
93 @static | 93 @static |
94 */ | 94 */ |
95 function clobberGetService() { | 95 function clobberGetService() { |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 assert(service.get('upgrade_available'), true); | 266 assert(service.get('upgrade_available'), true); |
267 assert(service.get('upgrade_to'), 'precise/wordpress-15'); | 267 assert(service.get('upgrade_to'), 'precise/wordpress-15'); |
268 done(); | 268 done(); |
269 }, | 269 }, |
270 function() { | 270 function() { |
271 assert.fail('This should not have failed.'); | 271 assert.fail('This should not have failed.'); |
272 done(); | 272 done(); |
273 }); | 273 }); |
274 }); | 274 }); |
275 }); | 275 }); |
OLD | NEW |