1
0
mirror of https://github.com/yldio/copilot.git synced 2024-12-01 07:30:07 +02:00
copilot/packages/portal-api/test/_mocks/triton.js
2017-07-17 10:57:35 +01:00

25 lines
465 B
JavaScript

const Find = require('lodash.find');
module.exports = ({ machines = [], networks = [] }) => {
const getMachine = (machineId, cb) => {
cb(null, Find(machines, ['id', machineId]));
};
const getNetwork = (networkId, cb) => {
cb(null, Find(networks, ['id', networkId]));
};
const createClient = (opts, cb) => {
return cb(null, {
cloudapi: {
getMachine,
getNetwork
}
});
};
return {
createClient
};
};