def test_both_raises(self): uri = ( 'heavydb://*****:*****@{0}:6274/heavyai?' 'protocol=binary'.format(heavydb_host) ) with pytest.raises(TypeError): connect(uri=uri, user='******')
def test_connect_uri_and_others_raises(self): uri = ( 'heavydb://*****:*****@{0}:6274/heavyai?' 'protocol=binary'.format(heavydb_host) ) with pytest.raises(TypeError): connect(username='******', uri=uri)
def test_bad_binary_encryption_params(self): with pytest.raises(TypeError): connect( user='******', host=heavydb_host, dbname='heavyai', protocol='http', validate=False, )
def test_bad_protocol(self, mock_client): with pytest.raises(ValueError) as m: connect( user='******', host=heavydb_host, dbname='dbname', protocol='fake-proto', ) assert m.match('fake-proto')
def test_session_logon_success(self): conn = connect( user='******', password='******', host=heavydb_host, dbname='heavyai', ) sessionid = conn._session connnew = connect(sessionid=sessionid, host=heavydb_host) assert connnew._session == sessionid
def test_close(self): conn = connect( user='******', password='******', host=heavydb_host, dbname='heavyai', ) assert conn.closed == 0 conn.close() assert conn.closed == 1
def test_connect_http(self): con = connect( user="******", password='******', host=heavydb_host, port=6278, protocol='http', dbname='heavyai', ) assert con is not None
def mock_connection(mock_client): """Connection with mocked transport layer, and - username='******' - password='******' - host='localhost' - dbname='dbname' """ return connect(user='******', password='******', host='localhost', dbname='dbname')
def test_connect_uri(self): uri = ( 'heavydb://*****:*****@{0}:6274/heavyai?' 'protocol=binary'.format(heavydb_host) ) con = connect(uri=uri) assert con._user == 'admin' assert con._password == 'HyperInteractive' assert con._host == heavydb_host assert con._port == 6274 assert con._dbname == 'heavyai' assert con._protocol == 'binary'
def con(heavydb_server): """ Fixture to provide Connection for tests run against live HeavyDB instance """ return connect( user="******", password='******', host=heavydb_host, port=6274, protocol='binary', dbname='heavyai', )
def test_session_logon_failure(self): sessionid = 'ILoveDancingOnTables' with pytest.raises(Error): connect(sessionid=sessionid, host=heavydb_host, protocol='binary')
def test_raises_right_exception(self): with pytest.raises(OperationalError): connect(host=heavydb_host, protocol='binary', port=1234)
def test_host_specified(self): with pytest.raises(TypeError): connect(user='******')