~juju-gui/juju-gui/trunk

« back to all changes in this revision

Viewing changes to test/test_fakebackend.js

  • Committer: Jeff Pihach
  • Date: 2013-09-03 16:09:24 UTC
  • mfrom: (992.3.15 save-changed-1214087)
  • Revision ID: jeff.pihach@canonical.com-20130903160924-mjy240b4rx67dzn1
Only sends the changed config options.

1) There was a bug with the ghost constraints code which
   caused it to fail when deploying services on rapi.

2) The GUI now only sends configuration values to juju when
   those values differ from the defaults.

R=frankban, rharding
CC=
https://codereview.appspot.com/13252045

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
        annotations: {},
122
122
        aggregated_status: undefined,
123
123
        charm: 'cs:precise/wordpress-15',
124
 
        config: undefined,
 
124
        config: {
 
125
          debug: 'no',
 
126
          engine: 'nginx',
 
127
          tuning: 'single',
 
128
          'wp-content': ''
 
129
        },
125
130
        constraints: {},
126
131
        constraintsStr: undefined,
127
132
        destroyed: false,
216
221
 
217
222
    it('accepts a config.', function() {
218
223
      fakebackend.deploy(
219
 
          'cs:precise/wordpress-15', callback, {config: {funny: 'business'}});
220
 
      assert.deepEqual(result.service.get('config'), {funny: 'business'});
 
224
          'cs:precise/wordpress-15', callback, {config: {engine: 'apache'}});
 
225
      assert.deepEqual(result.service.get('config'), {
 
226
        debug: 'no',
 
227
        engine: 'apache',
 
228
        tuning: 'single',
 
229
        'wp-content': ''
 
230
      });
221
231
    });
222
232
 
223
233
    it('deploys multiple units.', function() {
247
257
      fakebackend.deploy(
248
258
          'cs:precise/wordpress-15',
249
259
          callback,
250
 
          {config: {funny: 'business'}, configYAML: 'funny: girl'});
251
 
      assert.deepEqual(result.service.get('config'), {funny: 'girl'});
 
260
          {config: {funny: 'business'}, configYAML: 'engine: apache'});
 
261
      assert.deepEqual(result.service.get('config'), {
 
262
        debug: 'no',
 
263
        engine: 'apache',
 
264
        tuning: 'single',
 
265
        'wp-content': ''
 
266
      });
252
267
    });
253
268
 
254
269
    it('rejects a non-string configYAML', function() {
264
279
          {configYAML:
265
280
                Y.io('assets/mysql-config.yaml', {sync: true}).responseText});
266
281
      assert.isObject(result.service.get('config'));
267
 
      assert.equal(result.service.get('config')['tuning-level'], 'super bad');
 
282
      assert.equal(result.service.get('config').tuning, 'super bad');
268
283
    });
269
284
 
270
285
    it('rejects unparseable YAML config string.', function() {