Skip to content

Commit b7f4f1d

Browse files
committed
Fixed build issues
1 parent 2079558 commit b7f4f1d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/sonic-py-common/tests/test_security_cipher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@
2020
class TestSecurityCipher(object):
2121
def test_passkey_encryption(self):
2222
with mock.patch("sonic_py_common.security_cipher.ConfigDBConnector", new=ConfigDBConnector), \
23-
mock.patch("builtins.open",mock.mock_open()) as mock_file:
23+
mock.patch("{}.open".format(BUILTINS),mock.mock_open()) as mock_file:
2424
temp = security_cipher()
2525

2626
# Use patch to replace the built-in 'open' function with a mock
27-
with mock.patch("builtins.open", mock.mock_open()) as mock_file:
27+
with mock.patch("{}.open".format(BUILTINS), mock.mock_open()) as mock_file:
2828
encrypt, err = temp.encrypt_passkey("TACPLUS", "passkey1", "TEST1")
2929
assert encrypt != "passkey1"
3030
assert err == None
3131

3232
def test_passkey_decryption(self):
3333
with mock.patch("sonic_py_common.security_cipher.ConfigDBConnector", new=ConfigDBConnector), \
34-
mock.patch("builtins.open", mock.mock_open()) as mock_file:
34+
mock.patch("{}.open".format(BUILTINS), mock.mock_open()) as mock_file:
3535
temp = security_cipher()
3636

3737
# Use patch to replace the built-in 'open' function with a mock
38-
with mock.patch("builtins.open", mock.mock_open()) as mock_file:
38+
with mock.patch("{}.open".format(BUILTINS), mock.mock_open()) as mock_file:
3939
encrypt, err = temp.encrypt_passkey("RADIUS", "passkey2", EXPECTED_PASSWD)
4040
assert err == None
4141

4242
# Use patch to replace the built-in 'open' function with a mock
43-
with mock.patch("builtins.open", mock.mock_open(read_data=EXPECTED_PASSWD)) as mock_file:
43+
with mock.patch("{}.open".format(BUILTINS), mock.mock_open(read_data=EXPECTED_PASSWD)) as mock_file:
4444
decrypt, err = temp.decrypt_passkey("RADIUS", encrypt)
4545
assert err == None
4646
assert decrypt == "passkey2"

0 commit comments

Comments
 (0)