<commit_before>import http
import pytest

from openfisca_core import scripts
from openfisca_web_api import app

TEST_COUNTRY_PACKAGE_NAME = "openfisca_country_template"
TEST_REFORMS_PATHS = [
    f"{TEST_COUNTRY_PACKAGE_NAME}.reforms.add_dynamic_variable.add_dynamic_variable",
    f"{TEST_COUNTRY_PACKAGE_NAME}.reforms.add_new_tax.add_new_tax",
    ]


# Create app as in 'openfisca serve' script
@pytest.fixture
def client():
    tax_benefit_system = scripts.build_tax_benefit_system(
        TEST_COUNTRY_PACKAGE_NAME,
        extensions = None,
        reforms = TEST_REFORMS_PATHS,
        )

    return app.create_app(tax_benefit_system).test_client()


def test_return_code_of_dynamic_variable(client):
    result = client.get("/variable/goes_to_school")

    assert result.status_code == http.client.OK


def test_return_code_of_has_car_variable(client):
    result = client.get("/variable/has_car")

    assert result.status_code == http.client.OK


def test_return_code_of_new_tax_variable(client):
    result = client.get("/variable/new_tax")

    assert result.status_code == http.client.OK<commit_msg>Test all country template's reforms on WebAPI<commit_after>import http
import pytest

from openfisca_core import scripts
from openfisca_web_api import app

TEST_COUNTRY_PACKAGE_NAME = "openfisca_country_template"
TEST_REFORMS_PATHS = [
    f"{TEST_COUNTRY_PACKAGE_NAME}.reforms.add_dynamic_variable.add_dynamic_variable",
    f"{TEST_COUNTRY_PACKAGE_NAME}.reforms.add_new_tax.add_new_tax",
    f"{TEST_COUNTRY_PACKAGE_NAME}.reforms.flat_social_security_contribution.flat_social_security_contribution",
    f"{TEST_COUNTRY_PACKAGE_NAME}.reforms.modify_social_security_taxation.modify_social_security_taxation",
    f"{TEST_COUNTRY_PACKAGE_NAME}.reforms.removal_basic_income.removal_basic_income",
    ]


# Create app as in 'openfisca serve' script
@pytest.fixture
def client():
    tax_benefit_system = scripts.build_tax_benefit_system(
        TEST_COUNTRY_PACKAGE_NAME,
        extensions = None,
        reforms = TEST_REFORMS_PATHS,
        )

    return app.create_app(tax_benefit_system).test_client()


def test_return_code_of_dynamic_variable(client):
    result = client.get("/variable/goes_to_school")

    assert result.status_code == http.client.OK


def test_return_code_of_has_car_variable(client):
    result = client.get("/variable/has_car")

    assert result.status_code == http.client.OK


def test_return_code_of_new_tax_variable(client):
    result = client.get("/variable/new_tax")

    assert result.status_code == http.client.OK


def test_return_code_of_social_security_contribution_variable(client):
    result = client.get("/variable/social_security_contribution")

    assert result.status_code == http.client.OK


def test_return_code_of_social_security_contribution_parameter(client):
    result = client.get("/parameter/taxes.social_security_contribution")

    assert result.status_code == http.client.OK


def test_return_code_of_basic_income_variable(client):
    result = client.get("/variable/basic_income")

    assert result.status_code == http.client.OK
{'fraction_non_alphanumeric': 0.08564069542820348, 'fraction_numerical': 0.0, 'mean_word_length': 5.366803278688525, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4034635', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1037, 'n_words': 143}