Skip to content

Instantly share code, notes, and snippets.

@kadams54
Created June 20, 2014 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadams54/bc7cfc5ddb722bd42cc8 to your computer and use it in GitHub Desktop.
Save kadams54/bc7cfc5ddb722bd42cc8 to your computer and use it in GitHub Desktop.
diff --git a/test/test_machine_view_panel.js b/test/test_machine_view_panel.js
index c576b5c..695dc56 100644
--- a/test/test_machine_view_panel.js
+++ b/test/test_machine_view_panel.js
@@ -403,7 +403,8 @@ describe('machine view panel view', function() {
assert.equal(placeArgs[1], 'new0');
});
- it('creates new container when dropped on container header', function() {
+ it.only('creates new container when dropped on container header',
+ function(done) {
view.render();
var toggleStub = utils.makeStubMethod(view, '_toggleAllPlacedMessage');
this._cleanups.push(toggleStub.reset);
@@ -428,25 +429,30 @@ describe('machine view panel view', function() {
}
});
// Confirm the container creation
+ createView.one('select').after('change', function() {
+ createView.one('.create').simulate('click');
+ });
+ createView.one('.create').after('click', function() {
+ assert.deepEqual(env.addMachines.lastArguments()[0], [{
+ containerType: 'lxc',
+ parentId: '5',
+ constraints: {
+ 'cpu-power': '',
+ mem: '',
+ 'root-disk': ''
+ }
+ }], 'Args passed to addMachines are incorrect');
+ // A new ghost machine has been added to the database.
+ assert.notEqual(machines.getById('5/lxc/new0'), null,
+ 'new container is not in the database');
+ var placeArgs = env.placeUnit.lastArguments();
+ assert.strictEqual(placeArgs[0].id, 'test/1',
+ 'the unit ID passed to placeUnit is incorrect');
+ assert.equal(placeArgs[1], '5/lxc/new0',
+ 'the container ID passed to placeUnit is incorrect');
+ done();
+ });
createView.one('select').simulate('change');
- createView.one('.create').simulate('click');
- assert.deepEqual(env.addMachines.lastArguments()[0], [{
- containerType: 'lxc',
- parentId: '5',
- constraints: {
- 'cpu-power': '',
- mem: '',
- 'root-disk': ''
- }
- }], 'Args passed to addMachines are incorrect');
- // A new ghost machine has been added to the database.
- assert.notEqual(machines.getById('5/lxc/new0'), null,
- 'new container is not in the database');
- var placeArgs = env.placeUnit.lastArguments();
- assert.strictEqual(placeArgs[0].id, 'test/1',
- 'the unit ID passed to placeUnit is incorrect');
- assert.equal(placeArgs[1], '5/lxc/new0',
- 'the container ID passed to placeUnit is incorrect');
});
it('displays new container form when dropped on a machine', function() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment