diff --git a/services/ans/test/unittest/notification_preferences_database_test.cpp b/services/ans/test/unittest/notification_preferences_database_test.cpp index 471bd29f4a9dedb22d948a6775e1bd40eaeabc01..d0ac919380836dcc52c3468c74ffcfefb5178105 100644 --- a/services/ans/test/unittest/notification_preferences_database_test.cpp +++ b/services/ans/test/unittest/notification_preferences_database_test.cpp @@ -465,5 +465,29 @@ HWTEST_F(NotificationPreferencesDatabaseTest, RemoveAllSlotsFromDisturbeDB_00100 std::string bundleKey = "BundleKey"; EXPECT_EQ(preferncesDB_->RemoveAllSlotsFromDisturbeDB(bundleKey), true); } + +/** + * @tc.number : RemoveNotificationEnable_00100 + * @tc.name : RemoveNotificationEnable + * @tc.desc : Test RemoveNotificationEnable function when parameter is normal return is true + * @tc.require : issueI5SR8J + */ +HWTEST_F(NotificationPreferencesDatabaseTest, RemoveNotificationEnable_00100, Function | SmallTest | Level1) +{ + int32_t userId = 1; + EXPECT_EQ(preferncesDB_->RemoveNotificationEnable(userId), true); +} + +/** + * @tc.number : RemoveDoNotDisturbDate_00100 + * @tc.name : RemoveDoNotDisturbDate + * @tc.desc : Test RemoveDoNotDisturbDate function when parameter is normal return is true + * @tc.require : issueI5SR8J + */ +HWTEST_F(NotificationPreferencesDatabaseTest, RemoveDoNotDisturbDate_00100, Function | SmallTest | Level1) +{ + int32_t userId = 1; + EXPECT_EQ(preferncesDB_->RemoveDoNotDisturbDate(userId), true); +} } // namespace Notification } // namespace OHOS diff --git a/services/ans/test/unittest/notification_preferences_test.cpp b/services/ans/test/unittest/notification_preferences_test.cpp index 0ffe922c44b75c6cca661735bded0862fb6d3d77..fed80303fd33f8cf851c240b1f0141a5533c4183 100644 --- a/services/ans/test/unittest/notification_preferences_test.cpp +++ b/services/ans/test/unittest/notification_preferences_test.cpp @@ -798,5 +798,85 @@ HWTEST_F(NotificationPreferencesTest, GetHasPoppedDialog_00100, Function | Small EXPECT_EQ((int)NotificationPreferences::GetInstance().GetHasPoppedDialog(bundleOption_, hasPopped), (int)ERR_OK); EXPECT_TRUE(hasPopped); } + +/** + * @tc.number : AddNotificationBundleProperty_00100 + * @tc.name : AddNotificationBundleProperty + * @tc.desc : Add a notification BundleProperty into distrube DB when bundleOption is null, + * return is ERR_ANS_PREFERENCES_NOTIFICATION_DB_OPERATION_FAILED. + * @tc.require : issueI5SR8J + */ +HWTEST_F(NotificationPreferencesTest, AddNotificationBundleProperty_00100, Function | SmallTest | Level1) +{ + EXPECT_EQ((int)NotificationPreferences::GetInstance().AddNotificationBundleProperty(bundleOption_), + (int)ERR_ANS_PREFERENCES_NOTIFICATION_DB_OPERATION_FAILED); +} + +/** + * @tc.number : AddNotificationBundleProperty_00200 + * @tc.name : AddNotificationBundleProperty + * @tc.desc : Add a notification BundleProperty into distrube DB when bundlename is null, + * return is ERR_ANS_INVALID_PARAM. + * @tc.require : issueI5SR8J + */ +HWTEST_F(NotificationPreferencesTest, AddNotificationBundleProperty_00200, Function | SmallTest | Level1) +{ + EXPECT_EQ((int)NotificationPreferences::GetInstance().AddNotificationBundleProperty(bundleEmptyOption_), + (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.number : RemoveNotificationAllSlots_00100 + * @tc.name : RemoveNotificationAllSlots + * @tc.desc : Test RemoveNotificationAllSlots function when bundlename is null, + * return is ERR_ANS_PREFERENCES_NOTIFICATION_BUNDLE_NOT_EXIST. + * @tc.require : issueI5SR8J + */ +HWTEST_F(NotificationPreferencesTest, RemoveNotificationAllSlots_00100, Function | SmallTest | Level1) +{ + EXPECT_EQ((int)NotificationPreferences::GetInstance().RemoveNotificationAllSlots(bundleOption_), + (int)ERR_ANS_PREFERENCES_NOTIFICATION_BUNDLE_NOT_EXIST); +} + +/** + * @tc.number : RemoveNotificationAllSlots_00200 + * @tc.name : RemoveNotificationAllSlots + * @tc.desc : Test RemoveNotificationAllSlots function when bundleOption is null, + * return is ERR_ANS_INVALID_PARAM. + * @tc.require : issueI5SR8J + */ +HWTEST_F(NotificationPreferencesTest, RemoveNotificationAllSlots_00200, Function | SmallTest | Level1) +{ + EXPECT_EQ((int)NotificationPreferences::GetInstance().RemoveNotificationAllSlots(bundleEmptyOption_), + (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.number : GetNotificationSlotsNumForBundle_00100 + * @tc.name : GetNotificationSlotsNumForBundle + * @tc.desc : Test GetNotificationSlotsNumForBundle function when bundlename is null, + * return is ERR_ANS_PREFERENCES_NOTIFICATION_BUNDLE_NOT_EXIST. + * @tc.require : issueI5SR8J + */ +HWTEST_F(NotificationPreferencesTest, GetNotificationSlotsNumForBundle_00100, Function | SmallTest | Level1) +{ + uint64_t num = 1; + EXPECT_EQ((int)NotificationPreferences::GetInstance().GetNotificationSlotsNumForBundle(bundleOption_, num), + (int)ERR_ANS_PREFERENCES_NOTIFICATION_BUNDLE_NOT_EXIST); +} + +/** + * @tc.number : GetNotificationSlotsNumForBundle_00200 + * @tc.name : GetNotificationSlotsNumForBundle + * @tc.desc : Test GetNotificationSlotsNumForBundle function when bundleOption is null, + * return is ERR_ANS_INVALID_PARAM. + * @tc.require : issueI5SR8J + */ +HWTEST_F(NotificationPreferencesTest, GetNotificationSlotsNumForBundle_00200, Function | SmallTest | Level1) +{ + uint64_t num = 2; + EXPECT_EQ((int)NotificationPreferences::GetInstance().GetNotificationSlotsNumForBundle(bundleEmptyOption_, num), + (int)ERR_ANS_INVALID_PARAM); +} } // namespace Notification } // namespace OHOS