LEFT | RIGHT |
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 18 matching lines...) Expand all Loading... |
29 }); | 29 }); |
30 | 30 |
31 it('must create derived attributes from official charm id', function() { | 31 it('must create derived attributes from official charm id', function() { |
32 var charm = new models.Charm( | 32 var charm = new models.Charm( |
33 {id: 'cs:precise/openstack-dashboard-0'}); | 33 {id: 'cs:precise/openstack-dashboard-0'}); |
34 charm.get('scheme').should.equal('cs'); | 34 charm.get('scheme').should.equal('cs'); |
35 var _ = expect(charm.get('owner')).to.not.exist; | 35 var _ = expect(charm.get('owner')).to.not.exist; |
36 charm.get('full_name').should.equal('precise/openstack-dashboard'); | 36 charm.get('full_name').should.equal('precise/openstack-dashboard'); |
37 charm.get('charm_store_path').should.equal( | 37 charm.get('charm_store_path').should.equal( |
38 'charms/precise/openstack-dashboard-0/json'); | 38 'charms/precise/openstack-dashboard-0/json'); |
| 39 }); |
| 40 |
| 41 it('can load options from both "options" and "config"', function() { |
| 42 var options = {foo: 'bar'}; |
| 43 var charm = new models.Charm({ |
| 44 id: 'cs:precise/openstack-dashboard-0', |
| 45 options: options |
| 46 }); |
| 47 assert.equal(charm.get('options'), options); |
| 48 charm = new models.Charm({ |
| 49 id: 'cs:precise/openstack-dashboard-0', |
| 50 config: { |
| 51 options: options |
| 52 } |
| 53 }); |
| 54 assert.equal(charm.get('options'), options); |
39 }); | 55 }); |
40 | 56 |
41 it('must convert timestamps into time objects', function() { | 57 it('must convert timestamps into time objects', function() { |
42 var time = 1349797266.032, | 58 var time = 1349797266.032, |
43 date = new Date(time), | 59 date = new Date(time), |
44 charm = new models.Charm( | 60 charm = new models.Charm( |
45 { id: 'cs:precise/foo-9', last_change: {created: time / 1000} }); | 61 { id: 'cs:precise/foo-9', last_change: {created: time / 1000} }); |
46 charm.get('last_change').created.should.eql(date); | 62 charm.get('last_change').created.should.eql(date); |
47 }); | 63 }); |
48 | 64 |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 assert.isFalse(mysql.hasErrors(), mysql.get('id')); | 936 assert.isFalse(mysql.hasErrors(), mysql.get('id')); |
921 }); | 937 }); |
922 | 938 |
923 it('can be filtered so that it returns only visible models', function() { | 939 it('can be filtered so that it returns only visible models', function() { |
924 var filtered = list.visible(); | 940 var filtered = list.visible(); |
925 assert.strictEqual(2, filtered.size()); | 941 assert.strictEqual(2, filtered.size()); |
926 assert.deepEqual([django, wordpress], filtered.toArray()); | 942 assert.deepEqual([django, wordpress], filtered.toArray()); |
927 }); | 943 }); |
928 | 944 |
929 }); | 945 }); |
LEFT | RIGHT |