Skip to content

Commit

Permalink
Add boto3 client mock
Browse files Browse the repository at this point in the history
  • Loading branch information
lvarin committed Dec 7, 2023
1 parent e794588 commit 986dc29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/test_s3_filer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
@pytest.fixture()
def moto_boto():
with mock_s3():
boto3.client('s3', endpoint_url="http://s3.amazonaws.com")

client = boto3.resource('s3',endpoint_url="http://s3.amazonaws.com")
client.create_bucket(Bucket='tesk')
client.Bucket('tesk').put_object(Bucket='tesk', Key='folder/file.txt', Body='')
Expand Down Expand Up @@ -45,7 +47,6 @@ def test_check_if_bucket_exists(moto_boto, path, url, ftype, expected):
# @patch('tesk_core.filer.os.makedirs')
# @patch('builtins.open')
# @patch('s3transfer.utils.OSUtils.rename_file')
@patch("tesk_core.filer_s3.S3Transput.extract_endpoint", return_value="http://s3.amazonaws.com")
@pytest.mark.parametrize("path, url, ftype,expected", [
("/home/user/filer_test/file.txt", "s3://tesk/folder/file.txt","FILE",0),
("/home/user/filer_test/file.txt", "s3://tesk/folder/file_new.txt","FILE",1),
Expand Down

0 comments on commit 986dc29

Please sign in to comment.