rowPattern.tag = RawBuffer(AES_GCM_TAG_SIZE, 1);
check_DB_integrity(rowPattern);
-}
-POSITIVE_TEST_CASE(DBtestBIG)
-{
- DB::Row rowPattern = create_default_row();
+
rowPattern.data = createBigBlob(4096);
rowPattern.dataSize = rowPattern.data.size();
- rowPattern.tag = RawBuffer(AES_GCM_TAG_SIZE, 1);
check_DB_integrity(rowPattern);
}
-POSITIVE_TEST_CASE(DBtestGlobal)
-{
- DB::Row rowPattern = create_default_row();
- rowPattern.data = RawBuffer(1024, 2);
- rowPattern.dataSize = rowPattern.data.size();
- rowPattern.tag = RawBuffer(AES_GCM_TAG_SIZE, 1);
-
- BOOST_REQUIRE_NO_THROW(m_db.saveRow(rowPattern));
- DB::Row name_duplicate = rowPattern;
- rowPattern.owner = rowPattern.owner + "1";
-}
POSITIVE_TEST_CASE(DBtestTransaction)
{
DB::Row rowPattern = create_default_row();
BOOST_CHECK_MESSAGE(!row_optional, "Row still present after rollback");
}
-POSITIVE_TEST_CASE(DBtestBackend)
-{
- DB::Row rowPattern = create_default_row();
- rowPattern.data = RawBuffer(32, 1);
- rowPattern.dataSize = rowPattern.data.size();
- rowPattern.tag = RawBuffer(AES_GCM_TAG_SIZE, 1);
-
- rowPattern.backendId = CryptoBackend::OpenSSL;
- check_DB_integrity(rowPattern);
-
- rowPattern.backendId = CryptoBackend::TrustZone;
- check_DB_integrity(rowPattern);
-
- rowPattern.backendId = CryptoBackend::None;
- check_DB_integrity(rowPattern);
-}
-
POSITIVE_TEST_CASE(DBtestMove)
{
struct TestCrypto : public DB::Crypto {
BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE(DBCRYPTO_CTOR_TEST)
+
+NEGATIVE_TEST_CASE(DBtestCryptoWrongPasswordLegacy)
+{
+ BOOST_REQUIRE_THROW(DB::Crypto(DB_TEST_DIR "/testme_ver3.db", "", CKM::RawBuffer(16)),
+ Exc::DatabaseFailed);
+}
+
+NEGATIVE_TEST_CASE(DBtestCryptoWrongPasswordCurrent)
+{
+ BOOST_REQUIRE_THROW(DB::Crypto("", DB_TEST_DIR "/testme0_ver4.db", CKM::RawBuffer(16)),
+ Exc::DatabaseFailed);
+}
+
+NEGATIVE_TEST_CASE(DBtestCryptoNonExistingBoth)
+{
+ BOOST_REQUIRE_THROW(DB::Crypto("/not/existing.db", "/not/existing.db", defaultPass),
+ Exc::DatabaseFailed);
+}
+
+NEGATIVE_TEST_CASE(DBtestCryptoNonExistingCurrent)
+{
+ BOOST_REQUIRE_THROW(DB::Crypto(DB_TEST_DIR "/testme_ver3.db", "/not/existing.db", defaultPass),
+ Exc::DatabaseFailed);
+}
+
+NEGATIVE_TEST_CASE(DBtestCryptoNotDatabaseLegacy)
+{
+ BOOST_REQUIRE_THROW(DB::Crypto("/usr/bin/yes", "", defaultPass), Exc::DatabaseFailed);
+}
+
+NEGATIVE_TEST_CASE(DBtestCryptoNotDatabaseCurrent)
+{
+ BOOST_REQUIRE_THROW(DB::Crypto("", "/usr/bin/yes", defaultPass), Exc::DatabaseFailed);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
BOOST_FIXTURE_TEST_SUITE(DBCRYPTO_PERF_TEST, DBFixture)