aboutsummaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2020-06-13 18:50:34 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2020-06-13 18:50:34 +0200
commit8009c37af6198e712e458d0810fe5eae4b2f0ee6 (patch)
tree026dc64d014c78bf664834e74e16c760773f616e /unittest
parente0f58556806ecde0a1ea3f1b306cb039cab00fc5 (diff)
parentfedf828e394938fb6f84407b4de7412a3fb6ec40 (diff)
downloadlibnitrokey-8009c37af6198e712e458d0810fe5eae4b2f0ee6.tar.gz
libnitrokey-8009c37af6198e712e458d0810fe5eae4b2f0ee6.tar.bz2
Merge branch 'serial-number-u32'
Return serial number as uint32_t Fixes #174
Diffstat (limited to 'unittest')
-rw-r--r--unittest/test_offline.cc4
-rw-r--r--unittest/test_pro.py9
2 files changed, 12 insertions, 1 deletions
diff --git a/unittest/test_offline.cc b/unittest/test_offline.cc
index 320ad48..3ca3905 100644
--- a/unittest/test_offline.cc
+++ b/unittest/test_offline.cc
@@ -67,6 +67,10 @@ TEST_CASE("Test C++ side behaviour in offline", "[fast]") {
REQUIRE(serial_number.empty());
REQUIRE_THROWS_AS(
+ i->get_serial_number_as_u32(), DeviceNotConnected
+ );
+
+ REQUIRE_THROWS_AS(
i->get_status(), DeviceNotConnected
);
diff --git a/unittest/test_pro.py b/unittest/test_pro.py
index 99d7b1f..d25a50e 100644
--- a/unittest/test_pro.py
+++ b/unittest/test_pro.py
@@ -704,6 +704,13 @@ def test_get_serial_number(C):
print(('Serial number of the device: ', sn))
+@pytest.mark.status
+def test_get_serial_number_as_u32(C):
+ sn = C.NK_device_serial_number_as_u32()
+ assert sn > 0
+ print(('Serial number of the device (u32): ', sn))
+
+
@pytest.mark.otp
@pytest.mark.parametrize("secret", ['000001', '00'*10+'ff', '00'*19+'ff', '000102',
'00'*29+'ff', '00'*39+'ff', '002EF43F51AFA97BA2B46418768123C9E1809A5B' ])
@@ -1038,4 +1045,4 @@ def test_OTP_all_rw(C):
this_loop_codes.append(('H', i, code))
all_codes.append(this_loop_codes)
from pprint import pprint
- pprint(all_codes) \ No newline at end of file
+ pprint(all_codes)