Fix mocks that were breaking Jasmine tests
- The getNode mock was wrapping the node in an outer object. This does not match the behaviour of the real function, and was breaking JavaScript unit tests. - The getPortsWithNode mock was wrapping the list of nodes in *two* outer objects, and not populating the created port objects with all the expected fields. This commit changes it to match the expected behaviour (and the real behaviour of the method it's mocking). Change-Id: I1abaaa932e4f80780d3b8d61c6ca12557430ab26
This commit is contained in:
parent
a887caa844
commit
a4c89967d8
@ -38,6 +38,8 @@
|
||||
function createPort(nodeUuid, index, extra) {
|
||||
var port = {uuid: portUuid(nodeUuid, index),
|
||||
address: portMacAddr(index)};
|
||||
port.id = port.uuid;
|
||||
port.name = port.address;
|
||||
if (angular.isDefined(extra)) {
|
||||
port.extra = extra;
|
||||
}
|
||||
@ -53,7 +55,7 @@
|
||||
var ironicAPI = {
|
||||
getNode: function (uuid) {
|
||||
var node = createNode(nodeName, uuid);
|
||||
return $q.when({data: node});
|
||||
return $q.when(node);
|
||||
},
|
||||
|
||||
getPortsWithNode: function (uuid) {
|
||||
@ -61,7 +63,7 @@
|
||||
for (var i = 0; i < numPorts; i++) {
|
||||
ports.push(createPort(uuid, i));
|
||||
}
|
||||
return $q.when({data: {items: ports}});
|
||||
return $q.when(ports);
|
||||
},
|
||||
|
||||
validateNode: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user