Exemple #1
0
def test_env_roles():
    fab_task_ = run_per_role(fab_task_check_roles)
    fab_task_("test", "all")
Exemple #2
0
def test_env_role2():
    fab_task_ = run_per_role(fab_task_check_role2)
    fab_task_("test", "role2")
Exemple #3
0
def test_run_per_role_provide_more_thon_one_position_arg_will_raise():
    with pytest.raises(TypeError):
        fab_task_ = run_per_role(fab_task, "whatever")
Exemple #4
0
def test_run_per_role_first_arg_is_not_callable_will_raise():
    with pytest.raises(TypeError):
        fab_task_ = run_per_role("whatever")
Exemple #5
0
def test_run_per_role_not_provide_env_and_role_will_raise():
    fab_task_ = run_per_role(fab_task)
    with pytest.raises(Exception):
        fab_task_()
Exemple #6
0
def test_run_per_role_for_specific_role():
    fab_task_ = run_per_role(fab_task_for_role2)
    fab_task_("test", "role2")
Exemple #7
0
def test_run_per_role_default_input():
    fab_task_ = run_per_role(
        prompts={"sudo password:"******"sudo_password")})(
            fab_sudo_task)
    fab_task_("test", "all")
Exemple #8
0
def test_run_per_role_ask_input():
    fab_task_ = run_per_role(inputs=["sudo password:"******"builtins.input",
                    lambda x: os.environ.get("sudo_password")):
        fab_task_("test", "all")
Exemple #9
0
def test_run_per_role():
    fab_task_ = run_per_role(fab_task)
    fab_task_("test", "all")