Skip to content

Commit

Permalink
fix: Clean up lingering test file (aws#5157)
Browse files Browse the repository at this point in the history
* Clean up lingering test file

* Mock the call to open instead (this is easier)

* make format and removed unused import
  • Loading branch information
lucashuy committed May 11, 2023
1 parent 6f2221c commit bbc0f03
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/unit/local/lambdafn/test_remote_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class TestUnzipFromUri(TestCase):
@patch("samcli.local.lambdafn.remote_files.progressbar")
@patch("samcli.local.lambdafn.remote_files.requests")
@patch("samcli.local.lambdafn.remote_files.os")
def test_successfully_unzip_from_uri(self, os_patch, requests_patch, progressbar_patch, path_patch, unzip_patch):
@patch("samcli.local.lambdafn.remote_files.open")
def test_successfully_unzip_from_uri(
self, open_mock, os_patch, requests_patch, progressbar_patch, path_patch, unzip_patch
):
get_request_mock = Mock()
get_request_mock.headers = {"Content-length": "200"}
get_request_mock.iter_content.return_value = [b"data1"]
Expand Down Expand Up @@ -40,8 +43,9 @@ def test_successfully_unzip_from_uri(self, os_patch, requests_patch, progressbar
@patch("samcli.local.lambdafn.remote_files.progressbar")
@patch("samcli.local.lambdafn.remote_files.requests")
@patch("samcli.local.lambdafn.remote_files.os")
@patch("samcli.local.lambdafn.remote_files.open")
def test_not_unlink_file_when_file_doesnt_exist(
self, os_patch, requests_patch, progressbar_patch, path_patch, unzip_patch
self, open_mock, os_patch, requests_patch, progressbar_patch, path_patch, unzip_patch
):
get_request_mock = Mock()
get_request_mock.headers = {"Content-length": "200"}
Expand Down Expand Up @@ -72,8 +76,9 @@ def test_not_unlink_file_when_file_doesnt_exist(
@patch("samcli.local.lambdafn.remote_files.progressbar")
@patch("samcli.local.lambdafn.remote_files.requests")
@patch("samcli.local.lambdafn.remote_files.os")
@patch("samcli.local.lambdafn.remote_files.open")
def test_unzip_from_uri_reads_AWS_CA_BUNDLE_env_var(
self, os_patch, requests_patch, progressbar_patch, path_patch, unzip_patch
self, open_mock, os_patch, requests_patch, progressbar_patch, path_patch, unzip_patch
):
get_request_mock = Mock()
get_request_mock.headers = {"Content-length": "200"}
Expand Down

0 comments on commit bbc0f03

Please sign in to comment.