Make username shorter in KeyProvider tests 99/197099/6
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 9 Jan 2019 11:48:39 +0000 (12:48 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 13 Feb 2019 12:37:15 +0000 (13:37 +0100)
USERNAME_LONG used in KeyProvider tests is 43 characters long while the
structure used for storing it has only 32 characters. After adding a size check
in WrappedKeyAndInfoContainer::setKeyInfoClient the tests started to fail.

This commit makes the passed string fit 32 characters and adds new test.

Change-Id: Ida8a574f805c9518d00ee810dbd3c2daed9ace55

tests/test_key-provider.cpp

index 4991c4d..81d381d 100644 (file)
@@ -32,7 +32,7 @@ const CKM::Password INCORRECT_PASSWORD = "AAAAAAAAAAAAAAAAAAAAA";
 const CKM::Password NEW_PASSWORD = "NEW12345TIZEN12345NEW";
 
 const std::string USERNAME_SHORT = "AB";
-const std::string USERNAME_LONG = "SOFTWARE_CENTER_SYSTEM_SW_LAB_SECURITY_PART";
+const std::string USERNAME_LONG = "SOFTWARE_CENTER_SYSTEM_SW_LAB";
 const std::string CLIENT_ID_1 = "SAMPLE_CLIENT_ID_1";
 const std::string CLIENT_ID_2 = "SAMPLE_CLIENT_ID_2";
 
@@ -171,6 +171,9 @@ BOOST_AUTO_TEST_CASE(wrapped_container)
        BOOST_REQUIRE_NO_THROW(wrappedContainer.setKeyInfoSalt(salt.data(), salt.size()));
        BOOST_REQUIRE_NO_THROW(wrappedContainer.setKeyInfoClient("key_info_client"));
 
+       BOOST_REQUIRE_THROW(wrappedContainer.setKeyInfoClient("key_info_client_waaaaay_too_long"),
+                           CKM::Exc::InternalError);
+
        CKM::WrappedKeyAndInfoContainer wrappedContainer2;
        BOOST_REQUIRE_NO_THROW(
                wrappedContainer2.setKeyInfo(&wrappedContainer.getWrappedKeyAndInfo().keyInfo));