Esempio n. 1
0
def test_companies_house_search_company_active(client):
    form = forms.CompaniesHouseSearch(data={
        'company_name': 'Thing',
        'company_number': '1234'
    },
                                      session=client.session)

    assert form.is_valid() is True
Esempio n. 2
0
def test_companies_house_search_company_dissolved(client):
    form = forms.CompaniesHouseSearch(data={
        'company_name': 'Thing',
        'company_number': '1234'
    },
                                      session=client.session)

    assert form.is_valid() is False
    assert form.errors['company_name'] == [form.MESSAGE_COMPANY_NOT_ACTIVE]
def test_companies_house_search_company_number_empty():
    form = forms.CompaniesHouseSearch(data={'company_name': 'Thing'})

    assert form.is_valid() is False

    url = reverse('enrolment-business-type')
    assert form.errors['company_name'] == [
        form.MESSAGE_COMPANY_NOT_FOUND.format(url=url)
    ]
def test_companies_house_search_company_number_incomplete_data(client):
    expected = 'Please contact support to register a Royal Charter Company.'
    form = forms.CompaniesHouseSearch(data={
        'company_name': 'Thing',
        'company_number': 'RC232323'
    },
                                      session=client.session)

    assert form.is_valid() is False
    assert form.errors['company_name'] == [expected]
def test_companies_house_search_company_name_empty(client):
    form = forms.CompaniesHouseSearch(data={}, session=client.session)

    assert form.is_valid() is False
    assert form.errors['company_name'] == ['This field is required.']
def test_companies_house_search_company_number_empty(client):
    form = forms.CompaniesHouseSearch(data={'company_name': 'Thing'},
                                      session=client.session)

    assert form.is_valid() is False
    assert form.errors['company_name'] == [form.MESSAGE_COMPANY_NOT_FOUND]