Esempio n. 1
0
def test_saphana_get_df_no_pw(mocker):
    snock = mocker.patch('pyhdb.connect')
    reasq = mocker.patch('pandas.read_sql')

    saphana_connector = SapHanaConnector(name='test',
                                         host='localhost',
                                         port=22,
                                         user='******')
    ds = SapHanaDataSource(domain='test', name='test', query='my_query')
    saphana_connector.get_df(ds)

    snock.assert_called_once_with('localhost', 22, 'ubuntu', '')
    reasq.assert_called_once_with('my_query', con=snock(), params=None)
Esempio n. 2
0
def test_raise_on_empty_query():
    with pytest.raises(ValidationError):
        SapHanaDataSource(domaine='test', name='test', query='')