Skip to content

Commit

Permalink
missed updates
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbo committed May 3, 2024
1 parent a6921fb commit 5b92c75
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
requests==2.31.0
boto3==1.14.20
humanize==4.4.0
stopit==1.1.2
psycopg2==2.9.9
cryptography==42.0.2
Expand Down
25 changes: 14 additions & 11 deletions test/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_it_uses_nvmrc_file_if_it_exists(self, mock_get_logger, mock_run, patch_
create_file(patch_clone_dir / NVMRC, contents='6')

mock_post_metrics = Mock()
setup_node(False, None, None, mock_post_metrics, None)
setup_node(False, None, None, mock_post_metrics)

mock_get_logger.assert_called_once_with('setup-node')

Expand All @@ -66,7 +66,7 @@ def test_installs_deps(self, mock_get_logger, mock_run, patch_clone_dir):
create_file(patch_clone_dir / PACKAGE_LOCK)

mock_post_metrics = Mock()
setup_node(False, None, None, mock_post_metrics, None)
setup_node(False, None, None, mock_post_metrics)

mock_get_logger.assert_called_once_with('setup-node')

Expand Down Expand Up @@ -95,7 +95,7 @@ def test_returns_code_when_err(self, mock_get_logger, mock_run):

mock_post_metrics = Mock()
with pytest.raises(CalledProcessError):
setup_node(False, None, None, mock_post_metrics, None)
setup_node(False, None, None, mock_post_metrics)


@patch('steps.build.run')
Expand Down Expand Up @@ -222,7 +222,7 @@ def test_no_ruby_version_file(self, mock_check_supported_ruby_version,
mock_get_logger, mock_run, patch_clone_dir):

mock_post_metrics = Mock()
setup_ruby(False, mock_post_metrics, None)
setup_ruby(False, mock_post_metrics)

mock_get_logger.assert_called_once_with('setup-ruby')
mock_logger = mock_get_logger.return_value
Expand All @@ -247,7 +247,7 @@ def test_it_uses_ruby_version_if_it_exists(self,
create_file(patch_clone_dir / RUBY_VERSION, version)

mock_post_metrics = Mock()
setup_ruby(False, mock_post_metrics, None)
setup_ruby(False, mock_post_metrics)

mock_get_logger.assert_called_once_with('setup-ruby')

Expand All @@ -271,7 +271,7 @@ def test_it_strips_and_quotes_ruby_version(self,
create_file(patch_clone_dir / RUBY_VERSION, version)

mock_post_metrics = Mock()
setup_ruby(False, mock_post_metrics, None)
setup_ruby(False, mock_post_metrics)

mock_get_logger.assert_called_once_with('setup-ruby')

Expand Down Expand Up @@ -303,7 +303,7 @@ def test_it_errors_when_rvm_install_fails(self,

mock_post_metrics = Mock()
with pytest.raises(Exception) as einfo:
setup_ruby(False, mock_post_metrics, None)
setup_ruby(False, mock_post_metrics)

mock_get_logger.assert_called_once_with('setup-ruby')

Expand Down Expand Up @@ -542,9 +542,10 @@ def test_it_is_callable(self, mock_get_logger, mock_run, patch_working_dir, patc

create_file(patch_clone_dir / HUGO_VERSION, version)

mock_post_metrics = Mock()
with requests_mock.Mocker() as m:
m.get(dl_url, text='fake-data')
download_hugo()
download_hugo(mock_post_metrics)

mock_get_logger.assert_called_once_with('download-hugo')

Expand Down Expand Up @@ -573,6 +574,7 @@ def test_it_is_callable_retry(self, mock_get_logger, mock_run, patch_working_dir

create_file(patch_clone_dir / HUGO_VERSION, version)

mock_post_metrics = Mock()
with requests_mock.Mocker() as m:
m.get(dl_url, [
dict(exc=requests.exceptions.ConnectTimeout),
Expand All @@ -582,7 +584,7 @@ def test_it_is_callable_retry(self, mock_get_logger, mock_run, patch_working_dir
dict(text='fake-data')
])

download_hugo()
download_hugo(mock_post_metrics)

mock_get_logger.assert_called_once_with('download-hugo')

Expand Down Expand Up @@ -612,6 +614,7 @@ def test_it_is_exception(self, mock_get_logger, mock_run, patch_working_dir, pat

create_file(patch_clone_dir / HUGO_VERSION, version)

mock_post_metrics = Mock()
with pytest.raises(Exception):
with requests_mock.Mocker() as m:
m.get(dl_url, [
Expand All @@ -622,7 +625,7 @@ def test_it_is_exception(self, mock_get_logger, mock_run, patch_working_dir, pat
dict(exc=requests.exceptions.ConnectTimeout),
])

download_hugo()
download_hugo(mock_post_metrics)

mock_get_logger.assert_called_once_with('download-hugo')

Expand Down Expand Up @@ -807,7 +810,7 @@ def test_it_uses_node_cache_when_package_lock(self, mock_sp_run, mock_cache_fold
create_file(patch_clone_dir / PACKAGE_LOCK, contents='hashable')

mock_post_metrics = Mock()
setup_node(True, None, None, mock_post_metrics, None)
setup_node(True, None, None, mock_post_metrics)

mock_get_logger.assert_called_once_with('setup-node')

Expand Down

0 comments on commit 5b92c75

Please sign in to comment.