<commit_before>import re
from fabric.api import env, run, task, hide
from envassert import detect, file, package, port, process, service
from hot.utils.test import get_artifacts, http_check


def drupal_is_responding():
    with hide('running', 'stdout'):
        site = "http://localhost/"
        homepage = run("wget --quiet --output-document - %s" % site)
    if re.search('Welcome to Drupal7', homepage):
        return True
    else:
        return False


@task
def check():
    env.platform_family = detect.detect()

    assert file.is_dir("/var/www/vhosts"), '/var/www/vhosts is wrong'
    assert port.is_listening(80), 'port 80 not listening'
    assert port.is_listening(8080), 'port 8080 not listening'
    assert package.installed("varnish"), 'varnish not installed'
    assert drupal_is_responding(), 'Drupal did not respond as expected.'

    apache_process = 'apache2'
    php_package = 'php5'

    if env.platform_family == 'debian':
        apache_process = 'apache2'
        php_package = 'php5'
    elif env.platform_family == 'rhel':
        apache_process = 'httpd'
        php_package = 'php'
    else:
        raise ValueError('OS ' + env.platform_family +
                         ' unknown, update tests.')

    assert package.installed(php_package), 'php not installed'
    assert process.is_up(apache_process), 'apache is not running'
    assert service.is_enabled(apache_process), 'apache is not enabled'


@task
def artifacts():
    env.platform_family = detect.detect()
    get_artifacts()
<commit_msg>Fix test for drupal check<commit_after>import re
from fabric.api import env, run, task, hide
from envassert import detect, file, package, port, process, service
from hot.utils.test import get_artifacts, http_check


def drupal_is_responding():
    with hide('running', 'stdout'):
        site = "http://localhost:8080/"
        homepage = run("wget --quiet --output-document - %s" % site)
    if re.search('Welcome to Drupal7', homepage):
        return True
    else:
        return False


@task
def check():
    env.platform_family = detect.detect()

    assert file.is_dir("/var/www/vhosts"), '/var/www/vhosts is wrong'
    assert port.is_listening(80), 'port 80 not listening'
    assert port.is_listening(8080), 'port 8080 not listening'
    assert package.installed("varnish"), 'varnish not installed'
    assert drupal_is_responding(), 'Drupal did not respond as expected.'

    apache_process = 'apache2'
    php_package = 'php5'

    if env.platform_family == 'debian':
        apache_process = 'apache2'
        php_package = 'php5'
    elif env.platform_family == 'rhel':
        apache_process = 'httpd'
        php_package = 'php'
    else:
        raise ValueError('OS ' + env.platform_family +
                         ' unknown, update tests.')

    assert package.installed(php_package), 'php not installed'
    assert process.is_up(apache_process), 'apache is not running'
    assert service.is_enabled(apache_process), 'apache is not enabled'


@task
def artifacts():
    env.platform_family = detect.detect()
    get_artifacts()

{'fraction_non_alphanumeric': 0.1132014271813169, 'fraction_numerical': 0.012325656827765165, 'mean_word_length': 3.195918367346939, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5799936', 'n_tokens_mistral': 969, 'n_tokens_neox': 897, 'n_words': 262}