Skip to content

Commit

Permalink
Add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
twangboy committed Jan 30, 2024
1 parent c4969a9 commit 9310815
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions changelog/65954.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed issue where Salt can't find libcrypto when pip installed from a cloned repo
1 change: 0 additions & 1 deletion salt/utils/rsax931.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Create and verify ANSI X9.31 RSA signatures using OpenSSL libcrypto
"""


import ctypes.util
import glob
import os
Expand Down
24 changes: 13 additions & 11 deletions tests/pytests/unit/utils/test_rsax931.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Test the RSA ANSI X9.31 signer and verifier
"""

import ctypes
import ctypes.util
import fnmatch
Expand All @@ -19,7 +18,7 @@
_find_libcrypto,
_load_libcrypto,
)
from tests.support.mock import patch, MagicMock
from tests.support.mock import MagicMock, patch


@pytest.fixture
Expand Down Expand Up @@ -223,10 +222,11 @@ def test_find_libcrypto_darwin_pip_install():
bin_path = "/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10"
expected = "/Library/Frameworks/Python.framework/Versions/3.10/lib/libcrypto.dylib"
glob_effect = ([], [], ["yay"], [], [], [], [])
with patch("salt.utils.platform.is_darwin", lambda: True),\
patch("sys.executable", bin_path),\
patch("os.path.islink", return_value=False),\
patch.object(glob, "glob", side_effect=glob_effect) as mock_glob:
with patch("salt.utils.platform.is_darwin", lambda: True), patch(
"sys.executable", bin_path
), patch("os.path.islink", return_value=False), patch.object(
glob, "glob", side_effect=glob_effect
) as mock_glob:
lib_path = _find_libcrypto()
assert lib_path == "yay"
mock_glob.assert_any_call(expected)
Expand All @@ -241,11 +241,13 @@ def test_find_libcrypto_darwin_pip_install_venv():
lnk_path = "/Users/bill/src/salt/venv/bin/python"
expected = "/Library/Frameworks/Python.framework/Versions/3.10/lib/libcrypto.dylib"
glob_effect = ([], [], ["yay"], [], [], [], [])
with patch("salt.utils.platform.is_darwin", lambda: True), \
patch("sys.executable", lnk_path), \
patch("os.path.islink", return_value=True), \
patch("os.path.realpath", return_value=src_path), \
patch.object(glob, "glob", side_effect=glob_effect) as mock_glob:
with patch("salt.utils.platform.is_darwin", lambda: True), patch(
"sys.executable", lnk_path
), patch("os.path.islink", return_value=True), patch(
"os.path.realpath", return_value=src_path
), patch.object(
glob, "glob", side_effect=glob_effect
) as mock_glob:
lib_path = _find_libcrypto()
assert lib_path == "yay"
mock_glob.assert_any_call(expected)
Expand Down

0 comments on commit 9310815

Please sign in to comment.