151 lines
5.7 KiB
C
151 lines
5.7 KiB
C
#include "testcases.h"
|
|
|
|
void TestCacheOpenSecretStore_Valid(void);
|
|
void TestCacheOpenSecretStore_Invalid_Input(void);
|
|
|
|
void TestCacheCloseSecretStore_Valid(void);
|
|
void TestCacheCloseSecretStore_CloseAfterClose(void);
|
|
void TestCacheCloseSecretStore_Invalid_Handle(void);
|
|
void TestCacheCloseSecretStore_WithoutOpen(void);
|
|
|
|
void TestCacheAddKeyChain_Valid(void);
|
|
void TestCacheAddKeyChain_LongKeychainId(void);
|
|
void TestCacheAddKeyChain_ExistingKeychain(void);
|
|
void TestCacheAddKeyChain_MaxKeychains(void);
|
|
void TestCacheEnumerateKeyChainIds_Valid(void);
|
|
void TestCacheEnumerateKeyChainIds_WithoutOpen(void);
|
|
void TestCacheEnumerateKeyChainIds_LessBufferLen(void);
|
|
void TestCacheEnumerateKeyChainIds_WithNoKeychains(void);
|
|
void TestCacheRemoveKeyChain_Valid(void);
|
|
void TestCacheRemoveKeyChain_NonExistentKeychain(void);
|
|
void TestCacheRemoveKeyChain_OverlappingNames(void);
|
|
|
|
void TestCacheRWRmSecret_ValidAddSecret(void);
|
|
void TestCacheRWRmSecret_LongSecretID(void);
|
|
void TestCacheRWSecret_ValidUpdateSecret(void);
|
|
void TestCacheRWRmSecret_NonExistentKeychain(void);
|
|
void TestCacheRWRmSecret_OverlappingNames(void);
|
|
|
|
void TestCacheGetSecretStoreInfo_Valid(void);
|
|
void TestCacheGetKeychainInfo_Valid(void);
|
|
void TestLockCache_Valid(void);
|
|
void TestUnlockCache_Valid(void);
|
|
|
|
/*
|
|
*/
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
CU_pSuite pGenericSSGroup = NULL;
|
|
CU_pSuite pKeyChainGroup = NULL;
|
|
CU_pSuite pSecretGroup = NULL;
|
|
CU_pTest pTest = NULL;
|
|
|
|
if (CU_initialize_registry())
|
|
return 1;
|
|
|
|
pGenericSSGroup = CU_add_suite("TestCacheOpenSecretStore",NULL,NULL);
|
|
if (!pGenericSSGroup)
|
|
{
|
|
CU_cleanup_registry();
|
|
return -1;
|
|
}
|
|
|
|
pTest = CU_add_test(pGenericSSGroup, "TestCacheOpenSecretStore_Valid",TestCacheOpenSecretStore_Valid);
|
|
TEST_PTEST
|
|
|
|
pTest = CU_add_test(pGenericSSGroup, "TestCacheOpenSecretStore_Invalid_Input",TestCacheOpenSecretStore_Invalid_Input);
|
|
TEST_PTEST
|
|
|
|
pGenericSSGroup = CU_add_suite("TestCacheCloseSecretStore",NULL,NULL);
|
|
if(!pGenericSSGroup)
|
|
{
|
|
CU_cleanup_registry();
|
|
return -1;
|
|
}
|
|
|
|
pTest = CU_add_test(pGenericSSGroup, "TestCacheCloseSecretStore_Valid",TestCacheCloseSecretStore_Valid);
|
|
TEST_PTEST
|
|
|
|
// pTest = CU_add_test(pGenericSSGroup, "TestCacheCloseSecretStore_WithoutOpen",TestCacheCloseSecretStore_WithoutOpen);
|
|
TEST_PTEST
|
|
|
|
pKeyChainGroup = CU_add_suite("TestCacheEnumerateKeyChainIds",NULL,NULL);
|
|
if(!pKeyChainGroup)
|
|
{
|
|
CU_cleanup_registry();
|
|
return -1;
|
|
}
|
|
|
|
pTest = CU_add_test(pKeyChainGroup,"TestCacheAddKeyChain_Valid",TestCacheAddKeyChain_Valid);
|
|
TEST_PTEST
|
|
|
|
pTest = CU_add_test(pKeyChainGroup, "TestCacheAddKeyChain_LongKeychainId",TestCacheAddKeyChain_LongKeychainId);
|
|
TEST_PTEST
|
|
|
|
pTest = CU_add_test(pKeyChainGroup, "TestCacheAddKeyChain_ExistingKeychain",TestCacheAddKeyChain_ExistingKeychain);
|
|
TEST_PTEST
|
|
pTest = CU_add_test(pKeyChainGroup, "TestCacheAddKeyChain_MaxKeychains",TestCacheAddKeyChain_MaxKeychains);
|
|
TEST_PTEST
|
|
pTest = CU_add_test(pKeyChainGroup, "TestCacheEnumerateKeyChainIds_Valid",TestCacheEnumerateKeyChainIds_Valid);
|
|
TEST_PTEST
|
|
// pTest = CU_add_test(pKeyChainGroup, "TestCacheEnumerateKeyChainIds_WithoutOpen",TestCacheEnumerateKeyChainIds_WithoutOpen);
|
|
TEST_PTEST
|
|
|
|
pTest = CU_add_test(pKeyChainGroup, "TestCacheEnumerateKeyChainIds_WithNoKeychains",TestCacheEnumerateKeyChainIds_WithNoKeychains);
|
|
TEST_PTEST
|
|
pTest = CU_add_test(pKeyChainGroup, "TestCacheRemoveKeyChain_Valid",TestCacheRemoveKeyChain_Valid);
|
|
TEST_PTEST
|
|
pTest = CU_add_test(pKeyChainGroup, "TestCacheRemoveKeyChain_NonExistentKeychain",TestCacheRemoveKeyChain_NonExistentKeychain);
|
|
TEST_PTEST
|
|
pTest = CU_add_test(pKeyChainGroup, "TestCacheRemoveKeyChain_OverlappingNames",TestCacheRemoveKeyChain_OverlappingNames);
|
|
TEST_PTEST
|
|
|
|
pSecretGroup = CU_add_suite("TestCacheSecretAPIs",NULL,NULL);
|
|
if(!pGenericSSGroup)
|
|
{
|
|
CU_cleanup_registry();
|
|
return -1;
|
|
}
|
|
pTest = CU_add_test(pSecretGroup, "TestCacheRWRmSecret_ValidAddSecret",TestCacheRWRmSecret_ValidAddSecret);
|
|
TEST_PTEST
|
|
|
|
pTest = CU_add_test(pSecretGroup, "TestCacheRWSecret_ValidUpdateSecret",TestCacheRWSecret_ValidUpdateSecret);
|
|
TEST_PTEST
|
|
pTest = CU_add_test(pSecretGroup, "TestCacheRWRmSecret_NonExistentKeychain",TestCacheRWRmSecret_NonExistentKeychain);
|
|
TEST_PTEST
|
|
|
|
pTest = CU_add_test(pSecretGroup, "TestCacheRWRmSecret_OverlappingNames",TestCacheRWRmSecret_OverlappingNames);
|
|
TEST_PTEST
|
|
|
|
pTest = CU_add_test(pSecretGroup, "TestCacheRWRmSecret_LongSecretID",TestCacheRWRmSecret_LongSecretID);
|
|
TEST_PTEST
|
|
|
|
pTest = CU_add_test(pGenericSSGroup, "TestCacheGetSecretStoreInfo_Valid",TestCacheGetSecretStoreInfo_Valid);
|
|
TEST_PTEST
|
|
|
|
pTest = CU_add_test(pGenericSSGroup, "TestCacheGetKeychainInfo_Valid",TestCacheGetKeychainInfo_Valid);
|
|
TEST_PTEST
|
|
|
|
pTest = CU_add_test(pGenericSSGroup, "TestLockCache_Valid",TestLockCache_Valid);
|
|
TEST_PTEST
|
|
|
|
pTest = CU_add_test(pGenericSSGroup, "TestUnlockCache_Valid",TestUnlockCache_Valid);
|
|
TEST_PTEST
|
|
|
|
/*DANGER - Test with latest cachelib*/
|
|
// pTest = CU_add_test(pKeyChainGroup, "TestCacheEnumerateKeyChainIds_LessBufferLen",TestCacheEnumerateKeyChainIds_LessBufferLen);
|
|
TEST_PTEST
|
|
// pTest = CU_add_test(pGenericSSGroup, "TestCacheCloseSecretStore_CloseAfterClose",TestCacheCloseSecretStore_CloseAfterClose);
|
|
TEST_PTEST
|
|
|
|
// pTest = CU_add_test(pGenericSSGroup, "TestCacheCloseSecretStore_Invalid_Handle",TestCacheCloseSecretStore_Invalid_Handle);
|
|
|
|
TEST_PTEST
|
|
/* Run the tests. */
|
|
// CU_curses_run_tests();
|
|
CU_console_run_tests();
|
|
CU_cleanup_registry();
|
|
return 0;
|
|
}
|