def test_install_with_value_error(self):
        bc = Faucet('f', data=self.valid_data)

        bc.api = MagicMock()

        bc._create_blockcreator = MagicMock(side_effect=RuntimeError())
        bc._block_creator.schedule_action = MagicMock()

        # TODO: better execption catching.
        with pytest.raises(Exception):
            bc.install()
            bc.state.check('actions', 'install', 'ok')
    def test_install(self):
        bc = Faucet('f', data=self.valid_data)
        # sp = MagicMock()
        # fs = MagicMock()
        # fs.path = 'mypath'
        # sp.get.return_value = fs
        # bc._node_sal.storagepools.get = MagicMock(return_value=sp)
        bc.api = MagicMock()

        waitf = MagicMock()
        bc._block_creator.schedule_action = MagicMock(return_value=waitf)

        bc.install()

        assert bc.api.services.find_or_create.called
        bc._block_creator.schedule_action.assert_called_once_with("install")
        # FIXME CHECK FOR WAITF
        # assert waitf.called

        bc.state.check('actions', 'install', 'ok')