1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
# pylint: disable=missing-module-docstring
# pylint: disable=invalid-name
# pylint: disable=missing-function-docstring
import platform
from smartcard.scard import (
SCARD_F_INTERNAL_ERROR,
SCARD_S_SUCCESS,
SCardGetErrorMessage,
)
def test_scard_get_error_message():
res = SCardGetErrorMessage(SCARD_S_SUCCESS)
# do not test on Windows
# the error messages are different and localized
if platform.system() == "Windows":
return
expected = "Command successful."
assert res == expected
res = SCardGetErrorMessage(SCARD_F_INTERNAL_ERROR)
expected = "Internal error."
assert res == expected
res = SCardGetErrorMessage(1)
expected = "Unknown error: 0x00000001"
# macOS bug not yet fixed
macos_bug_expected = "Unkown error: 0x00000001"
assert res in (expected, macos_bug_expected)
|