Skip to content

Commit 5c0455b

Browse files
committed
Fixed build issues
1 parent 5a2ef2f commit 5c0455b

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
@@ -14,27 +14,27 @@
1414
class TestSecurityCipher(object):
1515
def test_passkey_encryption(self):
1616
with mock.patch("sonic_py_common.security_cipher.ConfigDBConnector", new=ConfigDBConnector), \
17-
mock.patch("builtins.open", mock_open()) as mock_file:
17+
mock.patch("builtins.open",mock.mock_open()) as mock_file:
1818
temp = security_cipher()
1919

2020
# Use patch to replace the built-in 'open' function with a mock
21-
with mock.patch("builtins.open", mock_open()) as mock_file:
21+
with mock.patch("builtins.open", mock.mock_open()) as mock_file:
2222
encrypt, err = temp.encrypt_passkey("TACPLUS", "passkey1", "TEST1")
2323
assert encrypt != "passkey1"
2424
assert err == None
2525

2626
def test_passkey_decryption(self):
2727
with mock.patch("sonic_py_common.security_cipher.ConfigDBConnector", new=ConfigDBConnector), \
28-
mock.patch("builtins.open", mock_open()) as mock_file:
28+
mock.patch("builtins.open", mock.mock_open()) as mock_file:
2929
temp = security_cipher()
3030

3131
# Use patch to replace the built-in 'open' function with a mock
32-
with mock.patch("builtins.open", mock_open()) as mock_file:
32+
with mock.patch("builtins.open", mock.mock_open()) as mock_file:
3333
encrypt, err = temp.encrypt_passkey("RADIUS", "passkey2", EXPECTED_PASSWD)
3434
assert err == None
3535

3636
# Use patch to replace the built-in 'open' function with a mock
37-
with mock.patch("builtins.open", mock_open(read_data=EXPECTED_PASSWD)) as mock_file:
37+
with mock.patch("builtins.open", mock.mock_open(read_data=EXPECTED_PASSWD)) as mock_file:
3838
decrypt, err = temp.decrypt_passkey("RADIUS", encrypt)
3939
assert err == None
4040
assert decrypt == "passkey2"

0 commit comments

Comments
 (0)