def test_advanced_search_form_business_type_choices(client):
    with app.test_request_context():
        f = AdvancedSearchForm()
        choices = [('C', 'Corporation'),
                   ('D', 'Domestic Limited Partnership'),
                   ('F', 'Foreign Limited Partnership'),
                   ('G', 'Domestic Limited Liability Company'),
                   ('H', 'Foreign Limited Liability Company'),
                   ('I', 'Domestic Limited Liability Partnership'),
                   ('J', 'Foreign Limited Liability Partnership'),
                   ('K', 'General Partnership'),
                   ('L', 'Domestic Statutory Trust'),
                   ('M', 'Foreign Statutory Trust'),
                   ('O', 'Other'),
                   ('P', 'Domestic Stock Corporation'),
                   ('Q', 'Foreign Stock Corporation'),
                   ('R', 'Domestic Non-Stock Corporation'),
                   ('S', 'Foreign Non-Stock Corporation'),
                   ('T', 'All Entities'),
                   ('U', 'Domestic Credit Union Stock'),
                   ('V', 'Domestic Credit Union Non-Stock'),
                   ('W', 'Domestic Bank Stock'),
                   ('X', 'Domestic Bank Non-Stock'),
                   ('Y', 'Domestic Insurance Stock'),
                   ('Z', 'Domestic Insurance Non-Stock'),
                   ('B', 'Benefit Corporation')]
        assert f.business_type.choices == choices
def test_advanced_search_form_field(client):
    with app.test_request_context():
        f = AdvancedSearchForm()
        assert f.data == {
            'start_date': None, 'end_date': None, 'business_type': None,
            'active': False, 'choice': 'None', 'search_term': None
        }
def test_search_form_live_data(client):
    """ Do we get back a valid result including a redirect"""
    with app.test_request_context():
        form_data = {'search_term': 'r.c. bigelow', 'choice': 'business_name'}
        rv = client.post('/', data=form_data, follow_redirects=False)
        assert rv.status_code == 302
        expected = url_for('basic_search_results', query='r.c. bigelow', index_field='business_name', page=1)
        assert urlparse(rv.location).path == expected
Exemple #4
0
def test_advanced_search_form_search_field_choices(client):
    with app.test_request_context():
        f = AdvancedSearchForm()
        choices = [('business_name', 'Business Name'),
                   ('place_of_business_address', 'Business Address'),
                   ('bus_id', 'Business ID'),
                   ('filing_number', 'Filing Number'),
                   ('principal_name', 'Principal Name'),
                   ('principal_business_address', 'Principal Address')]
        assert f.choice.choices == choices
Exemple #5
0
def test_advanced_search_form_field(client):
    with app.test_request_context():
        f = AdvancedSearchForm()
        assert f.data == {
            'start_date': None,
            'end_date': None,
            'business_type': None,
            'active': False,
            'choice': 'None',
            'search_term': None
        }
Exemple #6
0
def test_search_form_live_data(client):
    """ Do we get back a valid result including a redirect"""
    with app.test_request_context():
        form_data = {'search_term': 'r.c. bigelow', 'choice': 'business_name'}
        rv = client.post('/', data=form_data, follow_redirects=False)
        assert rv.status_code == 302
        expected = url_for('basic_search_results',
                           query='r.c. bigelow',
                           index_field='business_name',
                           page=1)
        assert urlparse(rv.location).path == expected
def test_advanced_search_form_search_field_choices(client):
    with app.test_request_context():
        f = AdvancedSearchForm()
        choices = [
            ('business_name', 'Business Name'),
            ('place_of_business_address', 'Business Address'),
            ('bus_id', 'Business ID'),
            ('filing_number', 'Filing Number'),
            ('principal_name', 'Principal Name'),
            ('principal_business_address', 'Principal Address')
        ]
        assert f.choice.choices == choices
Exemple #8
0
def test_advanced_search_form_business_type_choices(client):
    with app.test_request_context():
        f = AdvancedSearchForm()
        choices = [('C', 'Corporation'), ('D', 'Domestic Limited Partnership'),
                   ('F', 'Foreign Limited Partnership'),
                   ('G', 'Domestic Limited Liability Company'),
                   ('H', 'Foreign Limited Liability Company'),
                   ('I', 'Domestic Limited Liability Partnership'),
                   ('J', 'Foreign Limited Liability Partnership'),
                   ('K', 'General Partnership'),
                   ('L', 'Domestic Statutory Trust'),
                   ('M', 'Foreign Statutory Trust'), ('O', 'Other'),
                   ('P', 'Domestic Stock Corporation'),
                   ('Q', 'Foreign Stock Corporation'),
                   ('R', 'Domestic Non-Stock Corporation'),
                   ('S', 'Foreign Non-Stock Corporation'),
                   ('T', 'All Entities'), ('U', 'Domestic Credit Union Stock'),
                   ('V', 'Domestic Credit Union Non-Stock'),
                   ('W', 'Domestic Bank Stock'),
                   ('X', 'Domestic Bank Non-Stock'),
                   ('Y', 'Domestic Insurance Stock'),
                   ('Z', 'Domestic Insurance Non-Stock'),
                   ('B', 'Benefit Corporation')]
        assert f.business_type.choices == choices
Exemple #9
0
def test_invalid_bus_id_redirect(client):
    with app.test_request_context():
        rv = client.get('/business/0038096a', follow_redirects=False)
        assert rv.status_code == 302
        expected = url_for('index')
        assert urlparse(rv.location).path == expected
Exemple #10
0
def test_search_type_processing(client):
    with app.test_request_context():
        page = basic_search_results(query='r.c. bigelow',
                                    page=1,
                                    index_field='bus_name')
        assert isinstance(page, str)
Exemple #11
0
def test_search_form_fields(client):
    with app.test_request_context():
        f = SearchForm()
        assert f.data == {'search_term': None, 'choice': 'None'}
        assert isinstance(f.choice, SelectField)
def test_search_form_fields(client):
    with app.test_request_context():
        f = SearchForm()
        assert f.data == {'search_term': None, 'choice': 'None'}
        assert isinstance(f.choice, SelectField)
def test_invalid_bus_id_redirect(client):
    with app.test_request_context():
        rv = client.get('/business/0038096a', follow_redirects=False)
        assert rv.status_code == 302
        expected = url_for('index')
        assert urlparse(rv.location).path == expected
def test_search_type_processing(client):
    with app.test_request_context():
        page = basic_search_results(query='r.c. bigelow', page=1, index_field = 'bus_name')
        assert isinstance(page, str)