Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1478)

Delta Between Two Patch Sets: test/test_model.js

Issue 6856070: Remove "requires" from modules-debug.js
Left Patch Set: Remove "requires" from modules-debug.js Created 12 years, 4 months ago
Right Patch Set: Remove "requires" from modules-debug.js Created 12 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 'use strict'; 1 'use strict';
2 2
3 (function() { 3 YUI(GlobalConfig).use('juju-models', function(Y) {
4
5 describe('charm normalization', function() { 4 describe('charm normalization', function() {
6 var models; 5 var models;
7 6
8 before(function(done) { 7 before(function() {
9 models = Y.namespace('juju.models'); 8 models = Y.namespace('juju.models');
10 done();
11 }); 9 });
12 10
13 it('must create derived attributes from official charm id', function() { 11 it('must create derived attributes from official charm id', function() {
14 var charm = new models.Charm( 12 var charm = new models.Charm(
15 {id: 'cs:precise/openstack-dashboard-0'}); 13 {id: 'cs:precise/openstack-dashboard-0'});
16 charm.get('scheme').should.equal('cs'); 14 charm.get('scheme').should.equal('cs');
17 var _ = expect(charm.get('owner')).to.not.exist; 15 var _ = expect(charm.get('owner')).to.not.exist;
18 charm.get('full_name').should.equal('precise/openstack-dashboard'); 16 charm.get('full_name').should.equal('precise/openstack-dashboard');
19 charm.get('charm_store_path').should.equal( 17 charm.get('charm_store_path').should.equal(
20 'charms/precise/openstack-dashboard-0/json'); 18 'charms/precise/openstack-dashboard-0/json');
21 }); 19 });
22 20
23 it('must convert timestamps into time objects', function() { 21 it('must convert timestamps into time objects', function() {
24 var time = 1349797266.032, 22 var time = 1349797266.032,
25 date = new Date(time), 23 date = new Date(time),
26 charm = new models.Charm( 24 charm = new models.Charm(
27 { id: 'cs:precise/foo-9', last_change: {created: time / 1000} }); 25 { id: 'cs:precise/foo-9', last_change: {created: time / 1000} });
28 charm.get('last_change').created.should.eql(date); 26 charm.get('last_change').created.should.eql(date);
29 }); 27 });
30 28
31 }); 29 });
32 30 });
31
32 YUI(GlobalConfig).use('juju-models', function(Y) {
33 describe('juju models', function() { 33 describe('juju models', function() {
34 var models; 34 var models;
35 35
36 before(function(done) { 36 before(function() {
37 models = Y.namespace('juju.models'); 37 models = Y.namespace('juju.models');
38 done();
39 }); 38 });
40 39
41 it('must be able to create charm', function() { 40 it('must be able to create charm', function() {
42 var charm = new models.Charm( 41 var charm = new models.Charm(
43 {id: 'cs:~alt-bac/precise/openstack-dashboard-0'}); 42 {id: 'cs:~alt-bac/precise/openstack-dashboard-0'});
44 charm.get('scheme').should.equal('cs'); 43 charm.get('scheme').should.equal('cs');
45 charm.get('owner').should.equal('alt-bac'); 44 charm.get('owner').should.equal('alt-bac');
46 charm.get('series').should.equal('precise'); 45 charm.get('series').should.equal('precise');
47 charm.get('package_name').should.equal('openstack-dashboard'); 46 charm.get('package_name').should.equal('openstack-dashboard');
48 charm.get('revision').should.equal(0); 47 charm.get('revision').should.equal(0);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 ['mysql', {name: 'la', role: 'lee'}]], 343 ['mysql', {name: 'la', role: 'lee'}]],
345 'interface': 'thing' 344 'interface': 'thing'
346 }); 345 });
347 db.relations.add([rel0, rel1, rel2, rel3, rel4]); 346 db.relations.add([rel0, rel1, rel2, rel3, rel4]);
348 Y.Array.map( 347 Y.Array.map(
349 db.relations.get_relations_for_service(service), 348 db.relations.get_relations_for_service(service),
350 function(r) { return r.get('id'); }) 349 function(r) { return r.get('id'); })
351 .should.eql(['relation-2', 'relation-3', 'relation-4']); 350 .should.eql(['relation-2', 'relation-3', 'relation-4']);
352 }); 351 });
353 }); 352 });
354 353 });
354
355 YUI(GlobalConfig).use(['juju-models', 'juju-gui', 'datasource-local',
356 'juju-tests-utils', 'json-stringify',
357 'juju-charm-store'], function(Y) {
355 describe('juju charm load', function() { 358 describe('juju charm load', function() {
356 var models, conn, env, app, container, charm_store, data, juju; 359 var models, conn, env, app, container, charm_store, data, juju;
357 360
358 before(function(done) { 361 before(function() {
359 models = Y.namespace('juju.models'); 362 models = Y.namespace('juju.models');
360 juju = Y.namespace('juju'); 363 juju = Y.namespace('juju');
361 done();
362 }); 364 });
363 365
364 beforeEach(function() { 366 beforeEach(function() {
365 conn = new (Y.namespace('juju-tests.utils')).SocketStub(), 367 conn = new (Y.namespace('juju-tests.utils')).SocketStub(),
366 env = new juju.Environment({conn: conn}); 368 env = new juju.Environment({conn: conn});
367 env.connect(); 369 env.connect();
368 conn.open(); 370 conn.open();
369 container = Y.Node.create('<div id="test" class="container"></div>'); 371 container = Y.Node.create('<div id="test" class="container"></div>');
370 data = []; 372 data = [];
371 charm_store = new juju.CharmStore( 373 charm_store = new juju.CharmStore(
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 charm_store, 499 charm_store,
498 function(err, data) { 500 function(err, data) {
499 if (!err) { 501 if (!err) {
500 assert.fail('should fail!'); 502 assert.fail('should fail!');
501 } 503 }
502 done(); 504 done();
503 }); 505 });
504 }); 506 });
505 507
506 }); 508 });
507 })(); 509 });
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b