예제 #1
0
def test_get_form_empty_query(mssql_connector):
    """It should give suggestions of the databases without changing the rest"""
    current_config = {}
    form = MSSQLDataSource.get_form(mssql_connector, current_config)

    assert form['properties']['database'] == {'$ref': '#/definitions/database'}
    assert form['definitions']['database'] == {
        'title': 'database',
        'description': 'An enumeration.',
        'type': 'string',
        'enum': ['master', 'tempdb', 'model', 'msdb'],
    }
예제 #2
0
def test_get_form_query_with_good_database(mssql_connector):
    """It should give suggestions of the databases without changing the rest"""
    current_config = {'database': 'master'}
    form = MSSQLDataSource.get_form(mssql_connector, current_config)

    assert form['properties']['database'] == {'$ref': '#/definitions/database'}
    assert form['definitions']['database'] == {
        'title': 'database',
        'description': 'An enumeration.',
        'type': 'string',
        'enum': ['master', 'tempdb', 'model', 'msdb'],
    }
    assert form['properties']['table'] == {'$ref': '#/definitions/table'}
    assert 'City' in form['definitions']['table']['enum']
    assert form['required'] == ['domain', 'name', 'database']