-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
6 changed files
with
156 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Testing connection bahaviours.""" | ||
|
||
import pandas as pd | ||
import pytest | ||
from dbrequests.mysql.tests.conftest import set_up_cats as reset | ||
from sqlalchemy.exc import InternalError | ||
|
||
|
||
@pytest.mark.usefixtures('db_connect_args') | ||
class TestConnectionWithConnectArgs: | ||
"""Test that passing on connect_args works for credentials.""" | ||
|
||
def test_send_query(self, db_connect_args): | ||
"""Test that we have working connection.""" | ||
reset(db_connect_args) | ||
res = db_connect_args.send_query('select 1 as x') | ||
assert res.shape == (1, 1) | ||
|
||
def test_send_data(self, db_connect_args): | ||
"""The connection has local_infile set to 0, so we expect an error.""" | ||
df_add = pd.DataFrame({ | ||
'name': ['Chill'], | ||
'owner': ['Alex'], | ||
'birth': ['2018-03-03'] | ||
}) | ||
|
||
reset(db_connect_args) | ||
with pytest.raises(InternalError): | ||
db_connect_args.send_data(df_add, 'cats', mode='insert') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters