Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import bug fix #110

Merged
merged 2 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion locopy/redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import os

from .database import Database
from .errors import DBError
from .errors import DBError, S3CredentialsError
from .logger import INFO, get_logger
from .s3 import S3
from .utility import (
Expand Down
13 changes: 7 additions & 6 deletions tests/test_redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ def test_constructor(mock_session, credentials, dbapi):
assert r.connection["password"] == "password"


@pytest.mark.parametrize("dbapi", DBAPIS)
def test_constructor_credential_error(credentials, dbapi, caplog):
r = Redshift(dbapi=dbapi, **credentials)
assert "S3 credentials were not found. S3 functionality is disabled" in caplog.text


@pytest.mark.parametrize("dbapi", DBAPIS)
@mock.patch("locopy.utility.open", mock.mock_open(read_data=GOOD_CONFIG_YAML))
@mock.patch("locopy.s3.Session")
Expand Down Expand Up @@ -487,12 +493,7 @@ def reset_mocks():
"/path/local_file.2.gz",
]
r.load_and_copy(
"/path/local_file",
"s3_bucket",
"table_name",
delim="|",
splits=3,
delete_s3_after=True,
"/path/local_file", "s3_bucket", "table_name", delim="|", splits=3, delete_s3_after=True
)

# assert
Expand Down