class CompanyFactory(factory.django.DjangoModelFactory): """Company factory.""" id = factory.LazyFunction(uuid.uuid4) created_by = factory.SubFactory(AdviserFactory) modified_by = factory.SubFactory(AdviserFactory) name = factory.Faker('company') alias = factory.Faker('company') registered_address_1 = factory.Sequence(lambda n: f'{n} Foo st.') registered_address_town = 'London' registered_address_country_id = constants.Country.united_kingdom.value.id trading_address_1 = factory.Sequence(lambda x: f'{x} Fake Lane') trading_address_town = 'Woodside' trading_address_country_id = constants.Country.united_kingdom.value.id business_type_id = BusinessTypeConstant.private_limited_company.value.id sector_id = constants.Sector.aerospace_assembly_aircraft.value.id archived = False uk_region_id = constants.UKRegion.england.value.id export_experience_category = factory.LazyFunction( ExportExperienceCategory.objects.order_by('?').first, ) turnover_range = factory.LazyFunction( lambda: random_obj_for_model(TurnoverRange)) employee_range = factory.LazyFunction( lambda: random_obj_for_model(EmployeeRange)) archived_documents_url_path = factory.Faker('uri_path') created_on = now() class Params: hq = factory.Trait(headquarter_type=factory.LazyFunction( lambda: random_obj_for_model(HeadquarterType)), ) class Meta: model = 'company.Company'
def test_add_without_permission(self, create_user): """Test adding a policy feedback interaction without the required permissions.""" adviser = AdviserFactory() company = CompanyFactory() contact = ContactFactory() policy_area = random_obj_for_model(PolicyArea) policy_issue_type = random_obj_for_model(PolicyIssueType) communication_channel = random_obj_for_model(CommunicationChannel) url = reverse('api-v3:interaction:collection') request_data = { 'kind': Interaction.KINDS.policy_feedback, 'communication_channel': communication_channel.pk, 'subject': 'whatever', 'date': date.today().isoformat(), 'dit_adviser': adviser.pk, 'notes': 'hello', 'company': company.pk, 'contact': contact.pk, 'service': Service.trade_enquiry.value.id, 'dit_team': Team.healthcare_uk.value.id, 'policy_areas': [policy_area.pk], 'policy_issue_type': policy_issue_type.pk, } user = create_user() api_client = self.create_api_client(user=user) response = api_client.post(url, request_data) assert response.status_code == status.HTTP_400_BAD_REQUEST assert response.json() == { 'kind': ['You don’t have permission to add this type of interaction.'], }
def test_update(self, wb_record, expected_fields, commit): """ Test that update_company_from_wb_record updates the company with the data from wb_record. """ factory_data = { 'duns_number': None, 'name': 'Previous name', 'trading_names': ['Previous trading name'], 'company_number': '87654321', 'number_of_employees': 999, 'is_number_of_employees_estimated': False, 'employee_range': random_obj_for_model(EmployeeRange), 'turnover': 888, 'is_turnover_estimated': False, 'turnover_range': random_obj_for_model(TurnoverRange), 'address_1': '999', 'address_2': 'Street Main', 'address_town': 'Manchester', 'address_county': 'Manchester', 'address_country_id': UNITED_KINGDOM_COUNTRY_UUID, 'address_postcode': 'M90 1QX', 'registered_address_1': '999', 'registered_address_2': 'Street Main', 'registered_address_town': 'Manchester', 'registered_address_county': 'Manchester', 'registered_address_country_id': UNITED_KINGDOM_COUNTRY_UUID, 'registered_address_postcode': 'M90 1QX', 'trading_address_1': '999', 'trading_address_2': 'Street Main', 'trading_address_town': 'Manchester', 'trading_address_county': 'Manchester', 'trading_address_country_id': UNITED_KINGDOM_COUNTRY_UUID, 'trading_address_postcode': 'M90 1QX', 'archived': False, 'archived_on': None, 'archived_reason': '', } company = CompanyFactory(**factory_data) updated_fields = update_company_from_wb_record(company, wb_record, commit=commit) company.refresh_from_db() if commit: actual_fields = { field_name: getattr(company, field_name) for field_name in expected_fields } assert actual_fields == expected_fields else: actual_fields = { field_name: getattr(company, field_name) for field_name in factory_data } assert actual_fields == factory_data assert set(updated_fields) == set(expected_fields)
def test_one_list_report_generation(): """Test the generation of the One List.""" companies = CompanyFactory.create_batch( 2, headquarter_type_id=constants.HeadquarterType.ghq.value.id, classification=factory.Iterator( CompanyClassification.objects.all(), # keeps the ordering ), one_list_account_owner=AdviserFactory(), ) # ignored because headquarter_type is None CompanyFactory( headquarter_type=None, classification=random_obj_for_model(CompanyClassification), one_list_account_owner=AdviserFactory(), ) # ignored because classification is None CompanyFactory( headquarter_type_id=constants.HeadquarterType.ghq.value.id, classification=None, one_list_account_owner=AdviserFactory(), ) # ignored because one_list_account_owner is None CompanyFactory( headquarter_type_id=constants.HeadquarterType.ghq.value.id, classification=random_obj_for_model(CompanyClassification), one_list_account_owner=None, ) report = OneListReport() assert list(report.rows()) == [{ 'name': company.name, 'classification__name': company.classification.name, 'sector__segment': company.sector.segment, 'primary_contact_name': company.one_list_account_owner.name, 'one_list_account_owner__telephone_number': company.one_list_account_owner.telephone_number, 'one_list_account_owner__contact_email': company.one_list_account_owner.contact_email, 'registered_address_country__name': company.registered_address_country.name, 'registered_address_town': company.registered_address_town, 'url': f'{settings.DATAHUB_FRONTEND_URL_PREFIXES["company"]}/{company.id}', } for company in companies]
def test_promoting_a_ch_company_creates_a_new_version(self): """Test that promoting a CH company to full company creates a new version.""" assert Version.objects.count() == 0 CompaniesHouseCompanyFactory(company_number=1234567890) response = self.api_client.post( reverse('api-v4:company:collection'), data={ 'name': 'Acme', 'company_number': 1234567890, 'business_type': BusinessTypeConstant.company.value.id, 'sector': random_obj_for_model(Sector).id, 'address': { 'line_1': '75 Stramford Road', 'town': 'London', 'country': { 'id': Country.united_kingdom.value.id, }, }, 'uk_region': UKRegion.england.value.id, }, ) assert response.status_code == status.HTTP_201_CREATED company = Company.objects.get(pk=response.json()['id']) # check version created assert Version.objects.get_for_object(company).count() == 1 version = Version.objects.get_for_object(company).first() assert version.field_dict['company_number'] == '1234567890'
def test_create_end_date_before_start_date(self): """Tests specifying an end date before the start date.""" team = random_obj_for_model(TeamModel) url = reverse('api-v3:event:collection') request_data = { 'name': 'Grand exhibition', 'event_type': EventType.seminar.value.id, 'address_1': 'Grand Court Exhibition Centre', 'address_town': 'London', 'address_country': Country.united_kingdom.value.id, 'uk_region': UKRegion.east_of_england.value.id, 'service': Service.trade_enquiry.value.id, 'start_date': '2020-01-02', 'end_date': '2020-01-01', 'organiser': AdviserFactory().pk, 'lead_team': team.pk, 'teams': [team.pk], } response = self.api_client.post(url, data=request_data) assert response.status_code == status.HTTP_400_BAD_REQUEST response_data = response.json() assert response_data == { 'end_date': ['End date cannot be before start date.'], }
def test_create_non_uk_with_uk_region(self): """Tests creating a non-UK event with a UK region.""" team = random_obj_for_model(TeamModel) url = reverse('api-v3:event:collection') request_data = { 'name': 'Grand exhibition', 'event_type': EventType.seminar.value.id, 'end_date': '2010-09-12', 'address_1': 'Grand Court Exhibition Centre', 'address_town': 'London', 'address_country': Country.united_states.value.id, 'uk_region': UKRegion.east_of_england.value.id, 'service': Service.trade_enquiry.value.id, 'start_date': '2010-09-12', 'organiser': AdviserFactory().pk, 'lead_team': team.pk, 'teams': [team.pk], } response = self.api_client.post(url, data=request_data) assert response.status_code == status.HTTP_400_BAD_REQUEST response_data = response.json() assert response_data == { 'uk_region': ['Cannot specify a UK region for a non-UK country.'], }
def test_audit_log(s3_stubber): """Test that reversion revisions are created for updated rows.""" uk_region = random_obj_for_model(UKRegion) company_without_change = CompanyFactory(uk_region_id=uk_region.pk) company_with_change = CompanyFactory(uk_region_id=None) bucket = 'test_bucket' object_key = 'test_key' csv_content = f"""id,uk_region_id {company_without_change.pk},{uk_region.pk} {company_with_change.pk},{uk_region.pk} """ s3_stubber.add_response( 'get_object', { 'Body': BytesIO(csv_content.encode(encoding='utf-8')), }, expected_params={ 'Bucket': bucket, 'Key': object_key, }, ) call_command('update_company_uk_region', bucket, object_key) versions = Version.objects.get_for_object(company_without_change) assert versions.count() == 0 versions = Version.objects.get_for_object(company_with_change) assert versions.count() == 1 assert versions[0].revision.get_comment() == 'UK region updated.'
def policy_issue_types(self): """ Policy issue types field. Defaults to one random policy issue type. """ return [random_obj_for_model(PolicyIssueType)]
def test_company_export_country_history_create(self): """ Test that creating new CompanyExportCountry record sets up a corresponding history record. """ company = CompanyFactory() country = random_obj_for_model(CountryModel) adviser = AdviserFactory() company.add_export_country( country, CompanyExportCountry.Status.CURRENTLY_EXPORTING, company.created_on, adviser, True, ) export_country = company.export_countries.first() history = CompanyExportCountryHistory.objects.filter( id=export_country.id) assert history.count() == 1 assert history[0].id == export_country.id assert history[0].company == export_country.company assert history[0].country == export_country.country assert history[0].status == export_country.status assert history[ 0].history_type == CompanyExportCountryHistory.HistoryType.INSERT
def policy_areas(self): """ Policy areas field. Defaults to one random policy area. """ return [random_obj_for_model(PolicyArea)]
def test_create_end_date_without_start_date(self): """Tests specifying an end date without a start date.""" team = random_obj_for_model(TeamModel) url = reverse('api-v4:event:collection') request_data = { 'name': 'Grand exhibition', 'event_type': EventType.seminar.value.id, 'address_1': 'Grand Court Exhibition Centre', 'address_town': 'London', 'address_country': Country.united_kingdom.value.id, 'uk_region': UKRegion.east_of_england.value.id, 'service': Service.inbound_referral.value.id, 'end_date': '2020-01-01', 'organiser': AdviserFactory().pk, 'lead_team': team.pk, 'teams': [team.pk], 'has_related_trade_agreements': True, 'related_trade_agreements': [TradeAgreement.uk_japan.value.id], } response = self.api_client.post(url, data=request_data) assert response.status_code == status.HTTP_400_BAD_REQUEST response_data = response.json() assert response_data == { 'start_date': ['This field is required.'], }
def test_cannot_add(self, service, extra_data, expected_response, permissions): """Test that interaction with incorrect answers cannot be added.""" adviser = create_test_user(permission_codenames=permissions) contact = ContactFactory() communication_channel = random_obj_for_model(CommunicationChannel) url = reverse('api-v3:interaction:collection') request_data = { 'kind': Interaction.KINDS.interaction, 'communication_channel': communication_channel.pk, 'subject': 'whatever', 'date': date.today().isoformat(), 'dit_participants': [{ 'adviser': adviser.pk, }], 'company': contact.company.pk, 'contacts': [contact.pk], 'was_policy_feedback_provided': False, 'service': service, **resolve_data(extra_data), } api_client = self.create_api_client(user=adviser) response = api_client.post(url, request_data) assert response.status_code == status.HTTP_400_BAD_REQUEST response_data = response.json() assert response_data == expected_response
def test_add_creates_a_new_version(self): """Test that creating an interaction creates a new version.""" assert Version.objects.count() == 0 company = CompanyFactory() contact = ContactFactory(company=company) response = self.api_client.post( reverse('api-v3:interaction:collection'), data={ 'kind': Interaction.Kind.INTERACTION, 'communication_channel': random_obj_for_model(CommunicationChannel).pk, 'subject': 'whatever', 'date': date.today().isoformat(), 'dit_participants': [ {'adviser': AdviserFactory().pk}, ], 'notes': 'hello', 'company': company.pk, 'contacts': [contact.pk], 'service': Service.inbound_referral.value.id, 'was_policy_feedback_provided': False, }, ) assert response.status_code == status.HTTP_201_CREATED assert response.data['subject'] == 'whatever' interaction = Interaction.objects.get(pk=response.data['id']) # check version created assert Version.objects.get_for_object(interaction).count() == 1 version = Version.objects.get_for_object(interaction).first() assert version.revision.user == self.user assert version.field_dict['subject'] == 'whatever' assert not any(set(version.field_dict) & set(EXCLUDED_BASE_MODEL_FIELDS))
class CompanyInteractionFactory(InteractionFactoryBase): """Factory for creating an interaction relating to a company.""" kind = Interaction.Kind.INTERACTION theme = factory.Iterator(tuple(filter(None, Interaction.Theme.values))) communication_channel = factory.LazyFunction( lambda: random_obj_for_model(CommunicationChannel), )
class ArchivedContactFactory(ContactFactory): """Factory for an archived contact.""" archived = True archived_on = factory.Faker('past_datetime', tzinfo=utc) archived_by = factory.LazyFunction(lambda: random_obj_for_model(Advisor)) archived_reason = factory.Faker('sentence')
class InvestmentProjectInteractionFactory(InteractionFactoryBase): """Factory for creating an interaction relating to an investment project.""" kind = Interaction.KINDS.interaction investment_project = factory.SubFactory(InvestmentProjectFactory) communication_channel = factory.LazyFunction( lambda: random_obj_for_model(CommunicationChannel), )
def test_restricted_user_cannot_add_company_interaction(self): """Test that a restricted user cannot add a company interaction.""" requester = create_test_user( permission_codenames=[InteractionPermission.add_associated_investmentproject], ) url = reverse('api-v3:interaction:collection') api_client = self.create_api_client(user=requester) response = api_client.post( url, data={ 'kind': Interaction.KINDS.interaction, 'company': CompanyFactory().pk, 'contacts': [ContactFactory().pk], 'communication_channel': random_obj_for_model(CommunicationChannel).pk, 'subject': 'whatever', 'date': date.today().isoformat(), 'dit_adviser': requester.pk, 'notes': 'hello', 'service': Service.trade_enquiry.value.id, 'dit_team': Team.healthcare_uk.value.id, 'was_policy_feedback_provided': False, }, ) assert response.status_code == status.HTTP_400_BAD_REQUEST assert response.json() == { 'investment_project': ['This field is required.'], }
class CompanyInteractionFactoryWithPolicyFeedback(CompanyInteractionFactory): """ Factory for creating an interaction relating to a company, with policy feedback additionally provided. """ kind = Interaction.Kind.INTERACTION communication_channel = factory.LazyFunction( lambda: random_obj_for_model(CommunicationChannel), ) policy_feedback_notes = factory.Faker('paragraph', nb_sentences=10) was_policy_feedback_provided = True @to_many_field def policy_areas(self): """ Policy areas field. Defaults to one random policy area. """ return [random_obj_for_model(PolicyArea)] @to_many_field def policy_issue_types(self): """ Policy issue types field. Defaults to one random policy issue type. """ return [random_obj_for_model(PolicyIssueType)]
def test_add_creates_a_new_version(self): """Test that creating an event creates a new version.""" assert Version.objects.count() == 0 team = random_obj_for_model(TeamModel) response = self.api_client.post( reverse('api-v3:event:collection'), data={ 'name': 'Grand exhibition', 'event_type': EventType.seminar.value.id, 'address_1': 'Grand Court Exhibition Centre', 'address_town': 'New York', 'address_country': Country.united_states.value.id, 'service': Service.trade_enquiry.value.id, 'start_date': '2010-09-12', 'end_date': '2010-09-12', 'lead_team': team.pk, 'teams': [team.pk], }, ) assert response.status_code == status.HTTP_201_CREATED assert response.data['name'] == 'Grand exhibition' event = Event.objects.get(pk=response.data['id']) # check version created assert Version.objects.get_for_object(event).count() == 1 version = Version.objects.get_for_object(event).first() assert version.revision.user == self.user assert version.field_dict['name'] == 'Grand exhibition' assert not any( set(version.field_dict) & set(EXCLUDED_BASE_MODEL_FIELDS))
def test_error_returned_if_contacts_dont_belong_to_company(self): """ Test that an error is returned if the contacts don't belong to the specified company. """ company = CompanyFactory() contacts = [ContactFactory(), ContactFactory(company=company)] communication_channel = random_obj_for_model(CommunicationChannel) url = reverse('api-v3:interaction:collection') request_data = { 'kind': Interaction.Kind.INTERACTION, 'communication_channel': communication_channel.pk, 'subject': 'whatever', 'date': date.today().isoformat(), 'dit_participants': [ {'adviser': self.user.pk}, ], 'company': { 'id': company.pk, }, 'contacts': [{ 'id': contact.pk, } for contact in contacts], 'service': { 'id': random_service().pk, }, 'was_policy_feedback_provided': False, } api_client = self.create_api_client() response = api_client.post(url, request_data) assert response.status_code == status.HTTP_400_BAD_REQUEST assert response.json() == { 'non_field_errors': ['The interaction contacts must belong to the specified company.'], }
def test_create_minimal_success(self): """Tests successfully creating an event with only the required fields.""" team = random_obj_for_model(TeamModel) url = reverse('api-v3:event:collection') request_data = { 'name': 'Grand exhibition', 'event_type': EventType.seminar.value.id, 'address_1': 'Grand Court Exhibition Centre', 'address_town': 'New York', 'address_country': Country.united_states.value.id, 'service': Service.trade_enquiry.value.id, 'start_date': '2010-09-12', 'end_date': '2010-09-12', 'lead_team': team.pk, 'teams': [team.pk], } response = self.api_client.post(url, data=request_data) assert response.status_code == status.HTTP_201_CREATED response_data = _get_canonical_response_data(response) assert response_data == { 'id': response_data['id'], 'name': 'Grand exhibition', 'event_type': { 'id': EventType.seminar.value.id, 'name': EventType.seminar.value.name, }, 'start_date': '2010-09-12', 'end_date': '2010-09-12', 'location_type': None, 'notes': '', 'address_1': 'Grand Court Exhibition Centre', 'address_2': '', 'address_town': 'New York', 'address_county': '', 'address_postcode': '', 'address_country': { 'id': Country.united_states.value.id, 'name': Country.united_states.value.name, }, 'disabled_on': None, 'uk_region': None, 'organiser': None, 'lead_team': { 'id': str(team.pk), 'name': team.name, }, 'teams': [{ 'id': str(team.pk), 'name': team.name, }], 'related_programmes': [], 'service': { 'id': Service.trade_enquiry.value.id, 'name': Service.trade_enquiry.value.name, }, 'archived_documents_url_path': '', }
class PolicyFeedbackFactory(InteractionFactoryBase): """Factory for creating a policy feedback interaction.""" kind = Interaction.KINDS.policy_feedback communication_channel = factory.LazyFunction( lambda: random_obj_for_model(CommunicationChannel), ) policy_issue_type = factory.LazyFunction( lambda: random_obj_for_model(PolicyIssueType), ) @to_many_field def policy_areas(self): """ Policy areas field. Defaults to one random policy area. """ return [random_obj_for_model(PolicyArea)]
class InvestmentProjectInteractionFactory(InteractionFactoryBase): """Factory for creating an interaction relating to an investment project.""" kind = Interaction.Kind.INTERACTION theme = Interaction.Theme.INVESTMENT investment_project = factory.SubFactory(InvestmentProjectFactory) communication_channel = factory.LazyFunction( lambda: random_obj_for_model(CommunicationChannel), )
def test_error_returned_if_duplicate_participating_advisers_specified(self): """ Test that an error is returned if an adviser is specified as a DIT participant multiple times. """ contact = ContactFactory() communication_channel = random_obj_for_model(CommunicationChannel) dit_adviser = AdviserFactory() url = reverse('api-v3:interaction:collection') request_data = { 'kind': Interaction.Kind.INTERACTION, 'communication_channel': communication_channel.pk, 'subject': 'whatever', 'date': date.today().isoformat(), 'dit_participants': [ { 'adviser': { 'id': dit_adviser.pk, }, }, { 'adviser': { 'id': AdviserFactory().pk, }, }, { 'adviser': { 'id': dit_adviser.pk, }, }, ], 'company': { 'id': contact.company.pk, }, 'contacts': [{ 'id': contact.pk, }], 'service': { 'id': random_service().pk, }, 'was_policy_feedback_provided': False, } api_client = self.create_api_client() response = api_client.post(url, request_data) assert response.status_code == status.HTTP_400_BAD_REQUEST # An error should be returned for each duplicated item in the dit_participants list in # the request assert response.json() == { 'dit_participants': [ {'adviser': ['You cannot add the same adviser more than once.']}, {}, {'adviser': ['You cannot add the same adviser more than once.']}, ], }
def test_multiple_participating_advisers_can_be_specified(self): """Test that an interaction can be created with multiple DIT participants.""" contact = ContactFactory() communication_channel = random_obj_for_model(CommunicationChannel) advisers = AdviserFactory.create_batch(5) advisers.sort(key=attrgetter('pk')) url = reverse('api-v3:interaction:collection') request_data = { 'kind': Interaction.Kind.INTERACTION, 'communication_channel': communication_channel.pk, 'subject': 'whatever', 'date': date.today().isoformat(), 'dit_participants': [ { 'adviser': { 'id': adviser.pk, }, } for adviser in advisers ], 'company': { 'id': contact.company.pk, }, 'contacts': [{ 'id': contact.pk, }], 'service': { 'id': random_service().pk, }, 'was_policy_feedback_provided': False, } api_client = self.create_api_client() response = api_client.post(url, request_data) assert response.status_code == status.HTTP_201_CREATED response_data = response.json() response_data['dit_participants'].sort( key=lambda dit_participant: dit_participant['adviser']['id'], ) assert response_data['dit_participants'] == [ { 'adviser': { 'id': str(adviser.pk), 'first_name': adviser.first_name, 'last_name': adviser.last_name, 'name': adviser.name, }, 'team': { 'id': str(adviser.dit_team.pk), 'name': adviser.dit_team.name, }, } for adviser in advisers ]
class CompanyExportCountryFactory(factory.django.DjangoModelFactory): """Factory for Company export country""" company = factory.SubFactory(CompanyFactory) country = factory.LazyFunction(lambda: random_obj_for_model(Country)) status = CompanyExportCountry.EXPORT_INTEREST_STATUSES.currently_exporting created_by = factory.SubFactory(AdviserFactory) class Meta: model = 'company.CompanyExportCountry'
class InteractionExportCountryFactory(factory.django.DjangoModelFactory): """Factory for Interaction export country.""" interaction = factory.SubFactory(CompanyInteractionFactory) country = factory.LazyFunction(lambda: random_obj_for_model(Country)) status = factory.Iterator(tuple(CompanyExportCountry.EXPORT_INTEREST_STATUSES._db_values)) created_on = now() created_by = factory.SubFactory(AdviserFactory) class Meta: model = 'interaction.InteractionExportCountry'
def test_one_list_download(self): """Test the download of the One List.""" CompanyFactory.create_batch( 2, headquarter_type_id=constants.HeadquarterType.ghq.value.id, classification=random_obj_for_model(CompanyClassification), one_list_account_owner=AdviserFactory(), ) # ignored because headquarter_type is None CompanyFactory( headquarter_type=None, classification=random_obj_for_model(CompanyClassification), one_list_account_owner=AdviserFactory(), ) # ignored because classification is None CompanyFactory( headquarter_type_id=constants.HeadquarterType.ghq.value.id, classification=None, one_list_account_owner=AdviserFactory(), ) # ignored because one_list_account_owner is None CompanyFactory( headquarter_type_id=constants.HeadquarterType.ghq.value.id, classification=random_obj_for_model(CompanyClassification), one_list_account_owner=None, ) url = reverse('admin-report:download-report', kwargs={'report_id': 'one-list'}) user = create_test_user( permission_codenames=('view_company', ), is_staff=True, password=self.PASSWORD, ) client = self.create_client(user=user) response = client.get(url) assert response.status_code == status.HTTP_200_OK # 3 = header + the first 2 companies assert len(response.getvalue().decode('utf-8').splitlines()) == 3
def test_validate_verify_win_instance_with_cond_fields(): """Tests validation for the verify win stage for a complete project instance.""" adviser = AdviserFactory() strategic_drivers = [ constants.InvestmentStrategicDriver.access_to_market.value.id, ] project = InvestmentProjectFactory( stage_id=constants.InvestmentProjectStage.verify_win.value.id, client_contacts=[ContactFactory().id, ContactFactory().id], client_cannot_provide_total_investment=False, total_investment=100, client_cannot_provide_foreign_investment=False, foreign_equity_investment=200, number_new_jobs=10, client_considering_other_countries=False, client_requirements='client reqs', site_decided=False, strategic_drivers=strategic_drivers, uk_region_locations=[random_obj_for_model(UKRegion)], project_assurance_adviser=adviser, project_manager=adviser, government_assistance=False, number_safeguarded_jobs=0, r_and_d_budget=True, non_fdi_r_and_d_budget=True, associated_non_fdi_r_and_d_project=InvestmentProjectFactory(), new_tech_to_uk=True, export_revenue=True, address_1='12 London Road', address_town='London', address_postcode='SW1A 2AA', actual_uk_regions=[random_obj_for_model(UKRegion)], delivery_partners=[random_obj_for_model(InvestmentDeliveryPartner)], average_salary_id=constants.SalaryRange.below_25000.value.id, actual_land_date=date.today(), ) errors = validate(instance=project) assert not errors