Example #1
0
def test_client(tax_benefit_system):
    """ This module-scoped fixture creates an API client for the TBS defined in the `tax_benefit_system`
        fixture. This `tax_benefit_system` is mutable, so you can add/update variables.

    Example:

        .. code-block:: python

            from openfisca_country_template import entities
            from openfisca_core import periods
            from openfisca_core.variables import Variable
            ...

            class new_variable(Variable):
                value_type = float
                entity = entities.Person
                definition_period = periods.MONTH
                label = "New variable"
                reference = "https://law.gov.example/new_variable"  # Always use the most official source

            tax_benefit_system.add_variable(new_variable)
            flask_app = app.create_app(tax_benefit_system)

    """

    # Create the test API client
    flask_app = app.create_app(tax_benefit_system)
    return flask_app.test_client()
Example #2
0
 def load(self):
     tax_benefit_system = build_tax_benefit_system(
         self.options.get('country_package'),
         self.options.get('extensions'), self.options.get('reforms'))
     return create_app(tax_benefit_system, self.options.get('tracker_url'),
                       self.options.get('tracker_idsite'),
                       self.options.get('tracker_token'),
                       self.options.get('welcome_message'))
Example #3
0
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()
Example #4
0
 def load(self):
     tax_benefit_system = build_tax_benefit_system(
         self.options.get('country_package'),
         self.options.get('extensions'),
         self.options.get('reforms')
         )
     return create_app(
         tax_benefit_system,
         self.options.get('tracker_url'),
         self.options.get('tracker_idsite'),
         self.options.get('tracker_token'),
         self.options.get('welcome_message')
         )
Example #5
0
# -*- coding: utf-8 -*-
import pkg_resources
from openfisca_web_api.app import create_app
from openfisca_core.scripts import build_tax_benefit_system

TEST_COUNTRY_PACKAGE_NAME = 'openfisca_country_template'
distribution = pkg_resources.get_distribution(TEST_COUNTRY_PACKAGE_NAME)
tax_benefit_system = build_tax_benefit_system(TEST_COUNTRY_PACKAGE_NAME,
                                              extensions=None,
                                              reforms=None)
subject = create_app(tax_benefit_system).test_client()
Example #6
0
# -*- coding: utf-8 -*-
import pkg_resources
from openfisca_web_api.app import create_app
from openfisca_core.scripts import build_tax_benefit_system

TEST_COUNTRY_PACKAGE_NAME = 'openfisca_country_template'
distribution = pkg_resources.get_distribution(TEST_COUNTRY_PACKAGE_NAME)
tax_benefit_system = build_tax_benefit_system(TEST_COUNTRY_PACKAGE_NAME, extensions = None, reforms = None)
subject = create_app(tax_benefit_system).test_client()
Example #7
0
from openfisca_core.scripts import build_tax_benefit_system
from openfisca_web_api.app import create_app

country_package = 'openfisca_france'
extensions = ['openfisca_france_local', 'openfisca_paris', 'openfisca_brestmetropole', 'openfisca_rennesmetropole']

tax_benefit_system = build_tax_benefit_system(
    country_package_name = country_package,
    extensions = extensions,
    reforms = ['openfisca_france_local.fsl_factory.fsl_reform', 'openfisca_france_local.epci_test_factory.epci_reform']
)

application = create_app(tax_benefit_system)
Example #8
0
from openfisca_core.scripts import build_tax_benefit_system
from openfisca_web_api.app import create_app

country_package = 'openfisca_france'
extensions = ['openfisca_france_local', 'openfisca_paris', 'openfisca_brestmetropole', 'openfisca_rennesmetropole']

tax_benefit_system = build_tax_benefit_system(
    country_package_name = country_package,
    extensions = extensions,
    reforms = []
)

application = create_app(tax_benefit_system)