summaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-07-25 17:39:59 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-01 13:54:57 +0200
commit9413952f3c7d30bb462d4f1a211a3b0c2391f51e (patch)
treed8c01183ef6fe58e71d498cc0d720f7e06bd3f87 /unittest
parentdcd30dea651bad424219ae0f486fc6d49f534ee3 (diff)
downloadlibnitrokey-9413952f3c7d30bb462d4f1a211a3b0c2391f51e.tar.gz
libnitrokey-9413952f3c7d30bb462d4f1a211a3b0c2391f51e.tar.bz2
Refactor: remove magic numbers from code
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest')
-rw-r--r--unittest/test_bindings.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/unittest/test_bindings.py b/unittest/test_bindings.py
index 34bd21b..6e87c65 100644
--- a/unittest/test_bindings.py
+++ b/unittest/test_bindings.py
@@ -61,7 +61,7 @@ def test_user_PIN_change(C):
def test_HOTP_RFC(C):
# https://tools.ietf.org/html/rfc4226#page-32
- C.NK_write_hotp_slot(1, 'python_test', '12345678901234567890', 0, '123123123')
+ C.NK_write_hotp_slot(1, 'python_test', RFC_SECRET, 0, '123123123')
test_data = [
755224, 287082, 359152, 969429, 338314, 254676, 287922, 162583, 399871, 520489,
]
@@ -72,7 +72,7 @@ def test_HOTP_RFC(C):
def test_TOTP_RFC(C):
# test according to https://tools.ietf.org/html/rfc6238#appendix-B
- C.NK_write_totp_slot(1, 'python_test', '12345678901234567890', 30, True, '123123123')
+ C.NK_write_totp_slot(1, 'python_test', RFC_SECRET, 30, True, '123123123')
test_data = [
(59, 1, 94287082),
(1111111109, 0x00000000023523EC, 7081804),
@@ -90,11 +90,11 @@ def test_get_slot_names(C):
for i in range(16):
name = ffi.string(C.NK_get_totp_slot_name(i))
if name == '':
- assert C.NK_get_last_command_status() == 3 # NOT PROGRAMMED
+ assert C.NK_get_last_command_status() == DeviceErrorCode.NOT_PROGRAMMED
for i in range(3):
name = ffi.string(C.NK_get_hotp_slot_name(i))
if name == '':
- assert C.NK_get_last_command_status() == 3 # NOT PROGRAMMED
+ assert C.NK_get_last_command_status() == DeviceErrorCode.NOT_PROGRAMMED
def test_get_OTP_codes(C):
@@ -102,9 +102,9 @@ def test_get_OTP_codes(C):
for i in range(16):
code = C.NK_get_totp_code(i, 0, 0, 0)
if code == 0:
- assert C.NK_get_last_command_status() == 3 # NOT PROGRAMMED
+ assert C.NK_get_last_command_status() == DeviceErrorCode.NOT_PROGRAMMED
for i in range(3):
code = C.NK_get_hotp_code(i)
if code == 0:
- assert C.NK_get_last_command_status() == 3 # NOT PROGRAMMED
+ assert C.NK_get_last_command_status() == DeviceErrorCode.NOT_PROGRAMMED