Fix Javascript unit tests

Updated Javascript unit tests to support recent feature additions.

Change-Id: I9be76559fffe6ccb4d1af0d3bca3d0072ac2c7a9
This commit is contained in:
Peter Piela 2017-05-19 08:46:19 -04:00
parent aaf90c27a5
commit 2db9dfc3dd

View File

@ -23,6 +23,8 @@
var nodeName = "herp"; var nodeName = "herp";
var numPorts = 2; var numPorts = 2;
var bootDevice = {boot_device: 'pxe', persistent: true}; var bootDevice = {boot_device: 'pxe', persistent: true};
var consoleEnabled = true;
var consoleInfo = "console-info";
function portUuid(nodeUuid, index) { function portUuid(nodeUuid, index) {
return '' + index + index + nodeUuid.substring(2); return '' + index + index + nodeUuid.substring(2);
@ -73,9 +75,24 @@
validateNode: function() { validateNode: function() {
return $q.when({}); return $q.when({});
},
nodeGetConsole: function() {
return $q.when({console_enabled: consoleEnabled,
console_info: consoleInfo});
} }
}; };
var nodeActions = {
getPowerTransitions: function() {
return [];
}
};
beforeEach(module(function($provide) {
$provide.value('$uibModal', jasmine.createSpy());
}));
beforeEach(module('horizon.dashboard.admin.ironic')); beforeEach(module('horizon.dashboard.admin.ironic'));
beforeEach(module(function($provide) { beforeEach(module(function($provide) {
@ -113,7 +130,7 @@
{$scope: scope, {$scope: scope,
$location: $location, $location: $location,
'horizon.dashboard.admin.ironic.edit-port.service': {}, 'horizon.dashboard.admin.ironic.edit-port.service': {},
'horizon.dashboard.admin.ironic.actions': {}}); 'horizon.dashboard.admin.ironic.actions': nodeActions});
scope.$apply(); scope.$apply();
})); }));
@ -131,6 +148,8 @@
var node = createNode(nodeName, nodeUuid); var node = createNode(nodeName, nodeUuid);
node.id = node.uuid; node.id = node.uuid;
node.bootDevice = bootDevice; node.bootDevice = bootDevice;
node.console_enabled = consoleEnabled;
node.console_info = consoleInfo;
expect(ctrl.node).toEqual(node); expect(ctrl.node).toEqual(node);
}); });