# Path: cloudify_agent/installer/exceptions.py
# class AgentInstallerConfigurationError(exceptions.NonRecoverableError):
#     def __init__(self, msg):


from mock import Mock, patch
from cloudify_agent.installer import exceptions
    from cloudify_agent.installer.runners.fabric_runner import FabricRunner
    from cloudify_agent.installer.runners.fabric_runner import (
        FabricCommandExecutionException,
    )
import pytest


# these imports may run on a windows box, in which case they may fail. (if
# the pywin32 extensions). The tests wont run anyway because of the decorator,
# so we can just avoid this import.
try:
except ImportError:
    FabricRunner = None
    FabricCommandExecutionException = None


##############################################################################
# note that this file only tests validation and defaults of the fabric runner.
# it does not test the actual functionality because that requires starting
# a vm. functional tests are executed as local workflow tests in the system
# tests framework
##############################################################################

@pytest.mark.only_posix
def test_default_port():
    runner = FabricRunner(
        validate_connection=False,
        user='user',
        host='host',
        password='password')
    assert runner.port == 22


@pytest.mark.only_posix
def test_no_host():

# Path: cloudify_agent/installer/exceptions.py
# class AgentInstallerConfigurationError(exceptions.NonRecoverableError):
#     def __init__(self, msg):


# Path: cloudify_agent/tests/installer/runners/test_fabric_runner.py
from mock import Mock, patch
from cloudify_agent.installer import exceptions
    from cloudify_agent.installer.runners.fabric_runner import FabricRunner
    from cloudify_agent.installer.runners.fabric_runner import (
        FabricCommandExecutionException,
    )
import pytest



# these imports may run on a windows box, in which case they may fail. (if
# the pywin32 extensions). The tests wont run anyway because of the decorator,
# so we can just avoid this import.
try:
except ImportError:
    FabricRunner = None
    FabricCommandExecutionException = None


##############################################################################
# note that this file only tests validation and defaults of the fabric runner.
# it does not test the actual functionality because that requires starting
# a vm. functional tests are executed as local workflow tests in the system
# tests framework
##############################################################################

@pytest.mark.only_posix
def test_default_port():
    runner = FabricRunner(
        validate_connection=False,
        user='user',
        host='host',
        password='password')
    assert runner.port == 22


@pytest.mark.only_posix
def test_no_host():

    with pytest.raises(exceptions.AgentInstallerConfigurationError,