File diff 798fded7b618 → f4772b5c7f3a
roles/wsgi_website/molecule/default/tests/test_default.py
Show inline comments
 
@@ -249,6 +249,30 @@ def test_python_virtualenv_project_directory_config(host, project_file, expected
 
        assert project.mode == 0o640
 

	
 

	
 
@pytest.mark.parametrize("virtualenv_dir, admin_user, expected_prompt", [
 
    ('/var/www/parameters-mandatory/virtualenv', 'admin-parameters-mandatory', '(parameters-mandatory) '),
 
    ('/var/www/parameters-optional.local/virtualenv', 'admin-parameters-optional_local', '(parameters-optional.local) '),
 
    ('/var/www/parameters-paste-req/virtualenv', 'admin-parameters-paste-req', '(parameters-paste-req) '),
 
])
 
def test_python_virtualenv_prompt(host, virtualenv_dir, admin_user, expected_prompt):
 
    """
 
    Tests if Python virtual environment prompt has been set-up
 
    correctly.
 
    """
 

	
 
    with host.sudo(admin_user):
 
        prompt = host.run('bash -c "source %s/bin/activate; printenv PS1"', virtualenv_dir)
 

	
 
        # Chop off trailing newline if present (this is from the
 
        # host.run itself).
 
        if prompt.stdout.endswith("\n"):
 
            prompt_stdout = prompt.stdout[:-1]
 
        else:
 
            prompt_stdout = prompt.stdout
 

	
 
        assert prompt_stdout == expected_prompt
 

	
 

	
 
@pytest.mark.parametrize("wrapper_script, expected_owner, expected_group", [
 
    ('/var/www/parameters-mandatory/virtualenv/bin/exec', 'admin-parameters-mandatory', 'web-parameters-mandatory'),
 
    ('/var/www/parameters-optional.local/virtualenv/bin/exec', 'admin-parameters-optional_local', 'web-parameters-optional_local'),