summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBartlomiej Grzelewski <b.grzelewski@samsung.com>2017-06-01 12:12:09 +0200
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>2017-06-13 11:54:16 +0200
commit264ef0cba747a2849accd9cbec6df7d0989abc00 (patch)
tree3272b03cad08fd6db7fc8f4c4392b5c204496470 /test
parent8c3454fb15ab66a8d3519ad2917ff9c4f2dd3583 (diff)
downloadsecurity-manager-264ef0cba747a2849accd9cbec6df7d0989abc00.tar.gz
security-manager-264ef0cba747a2849accd9cbec6df7d0989abc00.tar.bz2
security-manager-264ef0cba747a2849accd9cbec6df7d0989abc00.zip
Accept null as appId during license extraction
In non-hybrid application appId is not placed inside smack label. Non-hybrid application could not be idenitified. We can only retrieve its pkgId. Change-Id: I52d35fab45dbf494dfc8a2de84c38d63d29b781d
Diffstat (limited to 'test')
-rw-r--r--test/test_privilege_db_app_defined_privileges.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/test_privilege_db_app_defined_privileges.cpp b/test/test_privilege_db_app_defined_privileges.cpp
index 82eca273..da33da6a 100644
--- a/test/test_privilege_db_app_defined_privileges.cpp
+++ b/test/test_privilege_db_app_defined_privileges.cpp
@@ -61,7 +61,7 @@ void AppDefinedPrivilegeFixture::checkClientLicense(const std::string &app, uid_
for (unsigned int i = 0; i < privileges.size(); ++i) {
std::string license;
- BOOST_REQUIRE(expected[i].first == testPrivDb->GetLicenseForClientPrivilege(app, uid, privileges[i], license));
+ BOOST_REQUIRE(expected[i].first == testPrivDb->GetLicenseForClientPrivilegeAndApp(app, uid, privileges[i], license));
BOOST_REQUIRE(license == expected[i].second);
}
}
@@ -102,11 +102,12 @@ BOOST_AUTO_TEST_CASE(T1300_app_defined_privileges)
PrivilegeDb::Exception::ConstraintError);
// check non-existing privilege
- std::string appName, license;
+ std::string appName, pkgName, license;
BOOST_REQUIRE_NO_THROW(
- testPrivDb->GetAppAndLicenseForAppDefinedPrivilege(uid(1), std::get<0>(privileges[1]),
- appName, license));
+ testPrivDb->GetAppPkgLicenseForAppDefinedPrivilege(uid(1), std::get<0>(privileges[1]),
+ appName, pkgName, license));
BOOST_REQUIRE(appName.empty());
+ BOOST_REQUIRE(pkgName.empty());
BOOST_REQUIRE(license.empty());
// first application defines second privilege
@@ -114,9 +115,10 @@ BOOST_AUTO_TEST_CASE(T1300_app_defined_privileges)
// check existing privilege application name
BOOST_REQUIRE_NO_THROW(
- testPrivDb->GetAppAndLicenseForAppDefinedPrivilege(uid(1), std::get<0>(privileges[1]),
- appName, license));
+ testPrivDb->GetAppPkgLicenseForAppDefinedPrivilege(uid(1), std::get<0>(privileges[1]),
+ appName, pkgName, license));
BOOST_REQUIRE(appName == app(1));
+ BOOST_REQUIRE(pkgName == pkg(1));
BOOST_REQUIRE(license == std::get<2>(privileges[1]));
// check first application privileges
@@ -193,7 +195,7 @@ BOOST_AUTO_TEST_CASE(T1400_client_license)
// check non-existing privilege
std::string license;
- BOOST_REQUIRE_NO_THROW(testPrivDb->GetLicenseForClientPrivilege(app(1), uid(1), privilegesA[1].first, license));
+ BOOST_REQUIRE_NO_THROW(testPrivDb->GetLicenseForClientPrivilegeAndApp(app(1), uid(1), privilegesA[1].first, license));
BOOST_REQUIRE(license.empty());
// first application use second privilege/license
@@ -213,7 +215,7 @@ BOOST_AUTO_TEST_CASE(T1400_client_license)
BOOST_REQUIRE_NO_THROW(testPrivDb->AddClientPrivilege(app(2), uid(2), privilegesB[0].first, privilegesB[0].second));
// check non-existing privilege
- BOOST_REQUIRE_NO_THROW(testPrivDb->GetLicenseForClientPrivilege(app(2), uid(2), privilegesB[1].first, license));
+ BOOST_REQUIRE_NO_THROW(testPrivDb->GetLicenseForClientPrivilegeAndApp(app(2), uid(2), privilegesB[1].first, license));
BOOST_REQUIRE(license.empty());
// second application use second privilege/license