From e647b0cf5def2c76958968ddad8f7808d966aa49 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 9 Nov 2016 14:55:48 +0100 Subject: Tests - ensure required env is set, fix HOTP const Signed-off-by: Szczepan Zalega --- unittest/test3.cc | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'unittest') diff --git a/unittest/test3.cc b/unittest/test3.cc index 8a9423f..6395cb6 100644 --- a/unittest/test3.cc +++ b/unittest/test3.cc @@ -48,19 +48,24 @@ TEST_CASE("write slot", "[pronew]"){ Stick10 stick; connect_and_setup(stick); - auto p = get_payload(); + auto p = get_payload(); strcpyT(p.slot_secret, RFC_SECRET); strcpyT(p.temporary_admin_password, temporary_password); p.use_8_digits = true; stick10_08::WriteToHOTPSlot::CommandTransaction::run(stick, p); - auto p2 = get_payload(); + auto p2 = get_payload(); strcpyT(p2.temporary_admin_password, temporary_password); p2.slot_number = 0 + 0x10; p2.slot_counter = 0; strcpyT(p2.slot_name, "test name aaa"); stick10_08::WriteToHOTPSlot_2::CommandTransaction::run(stick, p2); + auto pc = get_payload(); + pc.enable_user_password = 0; + strcpyT(pc.temporary_admin_password, temporary_password); + WriteGeneralConfig::CommandTransaction::run(stick, pc); + auto p3 = get_payload(); p3.slot_number = 0 + 0x10; GetHOTP::CommandTransaction::run(stick, p3); @@ -73,14 +78,19 @@ TEST_CASE("erase slot", "[pronew]"){ connect_and_setup(stick); authorize(stick); + auto p = get_payload(); + p.enable_user_password = 0; + strcpyT(p.temporary_admin_password, temporary_password); + WriteGeneralConfig::CommandTransaction::run(stick, p); + auto p3 = get_payload(); p3.slot_number = 0 + 0x10; GetHOTP::CommandTransaction::run(stick, p3); - auto erase_payload = get_payload(); + auto erase_payload = get_payload(); erase_payload.slot_number = 0 + 0x10; strcpyT(erase_payload.temporary_admin_password, temporary_password); - stick10_08::EraseSlot::CommandTransaction::run(stick, erase_payload); + EraseSlot::CommandTransaction::run(stick, erase_payload); auto p4 = get_payload(); p4.slot_number = 0 + 0x10; @@ -133,7 +143,7 @@ TEST_CASE("authorize user HOTP", "[pronew]") { ); strcpyT(p3.temporary_user_password, temporary_password); auto code_response = GetHOTP::CommandTransaction::run(stick, p3); - REQUIRE(code_response.data().code == 1284755224); + REQUIRE(code_response.data().code == 84755224); } -- cgit v1.2.3