aboutsummaryrefslogtreecommitdiff
path: root/unittest/constants.py
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2020-02-26 12:34:45 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2020-02-26 12:34:45 +0100
commit6100df4127eca5f9733cd5fa51acd32c8febd754 (patch)
tree281cd25844da3d4ea1fd424ecd3a90049d3fa1ac /unittest/constants.py
parent2c52393d12dbb16ce1d643cf020aff964da6ec89 (diff)
parentf37b771bbb8b665f4c0c1fe6f8336cf4fb458e5d (diff)
downloadlibnitrokey-6100df4127eca5f9733cd5fa51acd32c8febd754.tar.gz
libnitrokey-6100df4127eca5f9733cd5fa51acd32c8febd754.tar.bz2
Merge branch 'pro-bootloader'
Add tests for the Nitrokey Pro bootloader support. Allow to reconnect to the device during the test execution (e.g. for a reinsertion). Connected: https://github.com/Nitrokey/nitrokey-pro-firmware/issues/69
Diffstat (limited to 'unittest/constants.py')
-rw-r--r--unittest/constants.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/unittest/constants.py b/unittest/constants.py
index 645ef6a..4047f59 100644
--- a/unittest/constants.py
+++ b/unittest/constants.py
@@ -18,12 +18,7 @@ along with libnitrokey. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: LGPL-3.0
"""
-
-from misc import to_hex
-
-def bb(x):
- return bytes(x, encoding='ascii')
-
+from misc import to_hex, bb
RFC_SECRET_HR = '12345678901234567890'
RFC_SECRET = to_hex(RFC_SECRET_HR) # '31323334353637383930...'
@@ -39,6 +34,9 @@ class DefaultPasswords:
USER_TEMP = b'234234234'
UPDATE = b'12345678'
UPDATE_TEMP = b'123update123'
+ UPDATE_LONG = b'1234567890'*2
+ UPDATE_TOO_LONG = UPDATE_LONG + b'x'
+ UPDATE_TOO_SHORT = UPDATE_LONG[:7]
class DeviceErrorCode:
@@ -49,6 +47,7 @@ class DeviceErrorCode:
STATUS_NOT_AUTHORIZED = 5
STATUS_AES_DEC_FAILED = 0xa
STATUS_UNKNOWN_ERROR = 100
+ STATUS_DISCONNECTED = 255
class LibraryErrors:
@@ -59,4 +58,5 @@ class LibraryErrors:
HOTP_slot_count = 3
-TOTP_slot_count = 15 \ No newline at end of file
+TOTP_slot_count = 15
+PWS_SLOT_COUNT = 16