# Path: revolver/vagrant.py
# def inside():
# def is_running():
# def select():
# 
# Path: revolver/core.py
# VERSION = '0.0.5'
# def put(*args, **kwargs):
# def run(*args, **kwargs):
# def sudo(*args, **kwargs):


from fudge import patch
from revolver import vagrant, core

@patch("revolver.core.local")
def test_is_not_running_if_result_is_blank(local):
    local.expects_call().returns("")
    assert not vagrant.is_running()


@patch("revolver.core.local")
def test_is_running(local):
    local.expects_call().returns("some non empty string")
    assert vagrant.is_running()


@patch("revolver.vagrant.is_running", "revolver.log.abort")
def test_select_aborts_if_not_running(is_running, abort):
    is_running.expects_call().returns(False)
    abort.expects_call().with_args("Vagrant based VM currently NOT running")
    vagrant.select()


@patch("revolver.vagrant.is_running")
@patch("revolver.directory.temp_local")
@patch("revolver.core.local")
def test_select_changes_the_environment(is_running, temp_local, local):
    is_running.expects_call().returns(True)
    temp_local.expects_call().returns("/tmp")
    (local.expects_call()
        .with_args("vagrant ssh-config > /tmp/vagrant_ssh_config"))
    vagrant.select()


# Path: revolver/vagrant.py
# def inside():
# def is_running():
# def select():
# 
# Path: revolver/core.py
# VERSION = '0.0.5'
# def put(*args, **kwargs):
# def run(*args, **kwargs):
# def sudo(*args, **kwargs):


# Path: revolver/test/vagrant_test.py
from fudge import patch
from revolver import vagrant, core


@patch("revolver.core.local")
def test_is_not_running_if_result_is_blank(local):
    local.expects_call().returns("")
    assert not vagrant.is_running()


@patch("revolver.core.local")
def test_is_running(local):
    local.expects_call().returns("some non empty string")
    assert vagrant.is_running()


@patch("revolver.vagrant.is_running", "revolver.log.abort")
def test_select_aborts_if_not_running(is_running, abort):
    is_running.expects_call().returns(False)
    abort.expects_call().with_args("Vagrant based VM currently NOT running")
    vagrant.select()


@patch("revolver.vagrant.is_running")
@patch("revolver.directory.temp_local")
@patch("revolver.core.local")
def test_select_changes_the_environment(is_running, temp_local, local):
    is_running.expects_call().returns(True)
    temp_local.expects_call().returns("/tmp")
    (local.expects_call()
        .with_args("vagrant ssh-config > /tmp/vagrant_ssh_config"))
    vagrant.select()


    assert core.env.hosts == ["default"]