Exemple #1
0
 def test_both_raises(self):
     uri = (
         'heavydb://*****:*****@{0}:6274/heavyai?'
         'protocol=binary'.format(heavydb_host)
     )
     with pytest.raises(TypeError):
         connect(uri=uri, user='******')
Exemple #2
0
 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)
Exemple #3
0
 def test_bad_binary_encryption_params(self):
     with pytest.raises(TypeError):
         connect(
             user='******',
             host=heavydb_host,
             dbname='heavyai',
             protocol='http',
             validate=False,
         )
Exemple #4
0
 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')
Exemple #5
0
 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
Exemple #6
0
 def test_close(self):
     conn = connect(
         user='******',
         password='******',
         host=heavydb_host,
         dbname='heavyai',
     )
     assert conn.closed == 0
     conn.close()
     assert conn.closed == 1
Exemple #7
0
 def test_connect_http(self):
     con = connect(
         user="******",
         password='******',
         host=heavydb_host,
         port=6278,
         protocol='http',
         dbname='heavyai',
     )
     assert con is not None
Exemple #8
0
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')
Exemple #9
0
 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'
Exemple #10
0
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',
    )
Exemple #11
0
 def test_session_logon_failure(self):
     sessionid = 'ILoveDancingOnTables'
     with pytest.raises(Error):
         connect(sessionid=sessionid, host=heavydb_host, protocol='binary')
Exemple #12
0
 def test_raises_right_exception(self):
     with pytest.raises(OperationalError):
         connect(host=heavydb_host, protocol='binary', port=1234)
Exemple #13
0
 def test_host_specified(self):
     with pytest.raises(TypeError):
         connect(user='******')