From: Marcin Niesluchowski Date: Tue, 21 Oct 2014 09:34:12 +0000 (+0200) Subject: Revert commits to cynara tests X-Git-Tag: security-manager_5.5_testing~122^2~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F00%2F29100%2F1;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git Revert commits to cynara tests Some commits to cynara tests making security-tests not buildable with cynara release. This reverts commits: 1c357c2 "Fix cynara_check return codes" d2eb84f "Add tests for cynara_admin_check function" a58d784 "Enhance CynaraTestAdmin with adminCheck() method" e0b08a3 "Add tests for none bucket" Change-Id: If344771ef62de103c24cd551cd40a6b9b8be44a3 --- diff --git a/tests/cynara-tests/common/cynara_test_admin.cpp b/tests/cynara-tests/common/cynara_test_admin.cpp index d08263a..0270510 100644 --- a/tests/cynara-tests/common/cynara_test_admin.cpp +++ b/tests/cynara-tests/common/cynara_test_admin.cpp @@ -1,10 +1,7 @@ #include -#include #include #include -#include -#include namespace { @@ -111,54 +108,3 @@ void CynaraTestAdmin::setBucket(const char *bucket, int operation, const char *e << " operation: " << operation << "," << " extra: " << formatCstr(extra)); } - -void CynaraTestAdmin::adminCheck(const char *startBucket, int recursive, - const char *client, const char *user, const char *privilege, - int expectedCheckResult, const char *expectedCheckResultExtra, - int expectedResult) -{ - int checkResult; - char *checkResultExtra = nullptr; - - int ret = cynara_admin_check(m_admin, - startBucket, recursive, - client, user, privilege, - &checkResult, &checkResultExtra); - CStringPtr extra(checkResultExtra); - - auto dump = [&]() -> std::string - { - std::stringstream s; - s << " functionReturn: " << ret << "," - << " functionExpectedReturn: " << expectedResult << ","; - - s << " startBucket: " << formatCstr(startBucket) << "," - << " recursive: " << recursive << "," - << " client: " << formatCstr(client) << "," - << " user: " << formatCstr(user) << "," - << " privilege: " << formatCstr(privilege) << ","; - - s << " checkResult: " << checkResult << "," - << " expectedCheckResult: " << expectedCheckResult << "," - << " checkResultExtra: " << formatCstr(checkResultExtra) << "," - << " expectedCheckResultExtra: " << formatCstr(expectedCheckResultExtra); - return s.str(); - }; - - RUNNER_ASSERT_MSG(ret == expectedResult, - "cynara_admin_check returned wrong value: " - << ret << " != " << expectedResult << "." - << dump()); - - RUNNER_ASSERT_MSG(checkResult == expectedCheckResult, - "cynara_admin_check returned wrong check result: " - << checkResult << " != " << expectedCheckResult << "." - << dump()); - - RUNNER_ASSERT_MSG(formatCstr(checkResultExtra) == formatCstr(expectedCheckResultExtra), - "cynara_admin_check returned wrong check result extra: " - << formatCstr(checkResultExtra) << " != " - << formatCstr(expectedCheckResultExtra) << "." - << dump()); -} - diff --git a/tests/cynara-tests/common/cynara_test_admin.h b/tests/cynara-tests/common/cynara_test_admin.h index 66efe6f..f6b34f9 100644 --- a/tests/cynara-tests/common/cynara_test_admin.h +++ b/tests/cynara-tests/common/cynara_test_admin.h @@ -34,11 +34,6 @@ public: int expectedResult = CYNARA_ADMIN_API_SUCCESS); void setBucket(const char *bucket, int operation, const char *extra, int expectedResult = CYNARA_ADMIN_API_SUCCESS); - void adminCheck(const char *startBucket, int recursive, - const char *client, const char *user, const char *privilege, - int expectedCheckResult, const char *expectedCheckResultExtra, - int expectedResult = CYNARA_ADMIN_API_SUCCESS); - private: struct cynara_admin *m_admin; }; diff --git a/tests/cynara-tests/common/cynara_test_client.h b/tests/cynara-tests/common/cynara_test_client.h index 4fbe44a..e2832e9 100644 --- a/tests/cynara-tests/common/cynara_test_client.h +++ b/tests/cynara-tests/common/cynara_test_client.h @@ -11,7 +11,7 @@ public: void check(const char *client, const char *session, const char *user, const char *privilege, - int expectedResult = CYNARA_API_ACCESS_ALLOWED); + int expectedResult = CYNARA_API_SUCCESS); private: struct cynara *m_cynara; diff --git a/tests/cynara-tests/test_cases.cpp b/tests/cynara-tests/test_cases.cpp index 953ad86..afc8c03 100644 --- a/tests/cynara-tests/test_cases.cpp +++ b/tests/cynara-tests/test_cases.cpp @@ -112,7 +112,6 @@ void tc04_admin_set_policies_invalid_params_func() const char *privilege = "privilege04"; const int resultAllow = CYNARA_ADMIN_ALLOW; const int resultBucket = CYNARA_ADMIN_BUCKET; - const int resultNone = CYNARA_ADMIN_NONE; const char *resultExtra = nullptr; checkInvalidPolicy(admin, nullptr, client, user, privilege, resultAllow, resultExtra); @@ -121,7 +120,6 @@ void tc04_admin_set_policies_invalid_params_func() checkInvalidPolicy(admin, bucket, client, user, nullptr, resultAllow, resultExtra); checkInvalidPolicy(admin, bucket, client, user, privilege, INT_MAX, resultExtra); checkInvalidPolicy(admin, bucket, client, user, privilege, resultBucket, nullptr ); - checkInvalidPolicy(admin, bucket, client, user, privilege, resultNone, resultExtra); } void tc05_admin_set_bucket_invalid_params_func() @@ -131,13 +129,11 @@ void tc05_admin_set_bucket_invalid_params_func() const char *bucket = CYNARA_ADMIN_DEFAULT_BUCKET; const int operationAllow = CYNARA_ADMIN_ALLOW; const int operationDelete = CYNARA_ADMIN_DELETE; - const int operationNone = CYNARA_ADMIN_NONE; const char *extra = nullptr; admin.setBucket(nullptr, operationAllow, extra, CYNARA_ADMIN_API_INVALID_PARAM); admin.setBucket(bucket, INT_MAX, extra, CYNARA_ADMIN_API_INVALID_PARAM); admin.setBucket(bucket, operationDelete, extra, CYNARA_ADMIN_API_OPERATION_NOT_ALLOWED); - admin.setBucket(bucket, operationNone, extra, CYNARA_ADMIN_API_OPERATION_NOT_ALLOWED); } void tc06_cynara_check_empty_admin1_func() @@ -178,7 +174,7 @@ void tc07_admin_set_bucket_admin_allow_deny_func() admin.setBucket(bucket, CYNARA_ADMIN_ALLOW, extra); - cynara.check(client, session, user, privilege, CYNARA_API_ACCESS_ALLOWED); + cynara.check(client, session, user, privilege, CYNARA_API_SUCCESS); admin.setBucket(bucket, CYNARA_ADMIN_DENY, extra); @@ -210,7 +206,7 @@ void tc08_admin_set_policies_allow_remove1_func() cp.add(bucket, data[0][0], data[0][1], data[0][2], resultAllow, resultExtra); admin.setPolicies(cp); } - cynara.check(data[0][0], session, data[0][1], data[0][2], CYNARA_API_ACCESS_ALLOWED); + cynara.check(data[0][0], session, data[0][1], data[0][2], CYNARA_API_SUCCESS); cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_ACCESS_DENIED); // allow second policy @@ -219,8 +215,8 @@ void tc08_admin_set_policies_allow_remove1_func() cp.add(bucket, data[1][0], data[1][1], data[1][2], resultAllow, resultExtra); admin.setPolicies(cp); } - cynara.check(data[0][0], session, data[0][1], data[0][2], CYNARA_API_ACCESS_ALLOWED); - cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_ACCESS_ALLOWED); + cynara.check(data[0][0], session, data[0][1], data[0][2], CYNARA_API_SUCCESS); + cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_SUCCESS); // delete first policy { @@ -229,7 +225,7 @@ void tc08_admin_set_policies_allow_remove1_func() admin.setPolicies(cp); } cynara.check(data[0][0], session, data[0][1], data[0][2], CYNARA_API_ACCESS_DENIED); - cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_ACCESS_ALLOWED); + cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_SUCCESS); // delete second policy { @@ -266,7 +262,7 @@ void tc08_admin_set_policies_allow_remove2_func() cp.add(bucket, data[0][0], data[0][1], data[0][2], resultAllow, resultExtra); admin.setPolicies(cp); } - cynara.check(data[0][0], session, data[0][1], data[0][2], CYNARA_API_ACCESS_ALLOWED); + cynara.check(data[0][0], session, data[0][1], data[0][2], CYNARA_API_SUCCESS); cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_ACCESS_DENIED); // delete first, allow second policy @@ -277,7 +273,7 @@ void tc08_admin_set_policies_allow_remove2_func() admin.setPolicies(cp); } cynara.check(data[0][0], session, data[0][1], data[0][2], CYNARA_API_ACCESS_DENIED); - cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_ACCESS_ALLOWED); + cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_SUCCESS); // delete second policy { @@ -316,8 +312,8 @@ void tc08_admin_set_policies_allow_remove3_func() cp.add(bucket, data[1][0], data[1][1], data[1][2], resultAllow, resultExtra); admin.setPolicies(cp); } - cynara.check(data[0][0], session, data[0][1], data[0][2], CYNARA_API_ACCESS_ALLOWED); - cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_ACCESS_ALLOWED); + cynara.check(data[0][0], session, data[0][1], data[0][2], CYNARA_API_SUCCESS); + cynara.check(data[1][0], session, data[1][1], data[1][2], CYNARA_API_SUCCESS); // delete first and second policy { @@ -370,7 +366,7 @@ void checkSingleWildcardAllowRestDeny(const std::vector< std::vector