Ejemplo n.º 1
0
def setup_data(opensearch_with_collector):
    """Sets up data for the tests."""
    investor_company = CompanyFactory(name='large abcdef')
    argentina_investor_company = CompanyFactory(
        name='argentina plc',
        address_country_id=CountryConstant.argentina.value.id,
    )
    with freeze_time('2010-02-01'):
        frozen_created_on_profile = LargeCapitalInvestorProfileFactory(
            investor_company=CompanyFactory(
                name='Frozen limited',
            ),
            investor_description='frozen in 2010',
            construction_risks=[
                ConstructionRiskConstant.greenfield.value.id,
            ],
            desired_deal_roles=[
                DesiredDealRoleConstant.lead_manager.value.id,
            ],
            minimum_equity_percentage_id=EquityPercentageConstant.zero_percent.value.id,
            investable_capital=0,
            global_assets_under_management=10,
            uk_region_locations=[
                UKRegionConstant.north_west.value.id,
                UKRegionConstant.east_of_england.value.id,
            ],
        )
    with freeze_time('2018-01-01 10:00:00'):
        south_project = LargeCapitalInvestorProfileFactory(
            investor_company=CompanyFactory(
                name='South',
            ),
            investor_description='South Project',
            investment_types=[
                InvestmentTypesConstant.direct_investment_in_project_equity.value.id,
            ],
            global_assets_under_management=60,
        )
    with freeze_time('2018-01-01 11:00:00'):
        north_project = LargeCapitalInvestorProfileFactory(
            investable_capital=20,
            investor_company=CompanyFactory(
                name='North',
            ),
            investor_description='North Project',
            uk_region_locations=[
                UKRegionConstant.north_west.value.id,
                UKRegionConstant.north_east.value.id,
            ],
            other_countries_being_considered=[
                CountryConstant.ireland.value.id,
                CountryConstant.canada.value.id,
            ],
            global_assets_under_management=70,
        )

    with freeze_time('2019-01-01'):
        investor_profiles = [
            LargeCapitalInvestorProfileFactory(
                investor_description='Operational construction',
                investor_company=investor_company,
                investable_capital=950,
                construction_risks=[
                    ConstructionRiskConstant.operational.value.id,
                ],
                minimum_return_rate_id=ReturnRateConstant.up_to_five_percent.value.id,
                time_horizons=[
                    TimeHorizonConstant.up_to_five_years.value.id,
                    TimeHorizonConstant.five_to_nine_years.value.id,
                ],
                global_assets_under_management=20,
            ),
            LargeCapitalInvestorProfileFactory(
                investor_description='Argentina project',
                investor_company=argentina_investor_company,
                investable_capital=1490,
                construction_risks=[
                    ConstructionRiskConstant.brownfield.value.id,
                ],
                time_horizons=[
                    TimeHorizonConstant.up_to_five_years.value.id,
                ],
                restrictions=[
                    RestrictionConstant.inflation_adjustment.value.id,
                ],
                global_assets_under_management=30,
            ),
            frozen_created_on_profile,
            LargeCapitalInvestorProfileFactory(
                investor_company=CompanyFactory(
                    address_country_id=CountryConstant.argentina.value.id,
                    name='2 constructions ltd',
                ),
                investor_description='2 construction risks',
                construction_risks=[
                    ConstructionRiskConstant.brownfield.value.id,
                    ConstructionRiskConstant.greenfield.value.id,
                ],
                investable_capital=3000,
                asset_classes_of_interest=[
                    AssetClassInterestConstant.biomass.value.id,
                ],
                restrictions=[
                    RestrictionConstant.inflation_adjustment.value.id,
                ],
                global_assets_under_management=40,
            ),
            LargeCapitalInvestorProfileFactory(
                investor_company=CompanyFactory(
                    name='Deal up ltd',
                ),
                investable_capital=10,
                investor_description='Deal up',
                deal_ticket_sizes=[
                    DealTicketSizeConstant.up_to_forty_nine_million.value.id,
                ],
                asset_classes_of_interest=[
                    AssetClassInterestConstant.biofuel.value.id,
                ],
                time_horizons=[
                    TimeHorizonConstant.five_to_nine_years.value.id,
                ],
                restrictions=[
                    RestrictionConstant.liquidity.value.id,
                ],
                minimum_equity_percentage_id=EquityPercentageConstant.zero_percent.value.id,
                global_assets_under_management=50,
            ),
            north_project,
            south_project,
        ]
    opensearch_with_collector.flush_and_refresh()

    yield investor_profiles