mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-06-18 20:59:48 -04:00
Make ignored app tests actually test code in use.
The test was using a `findIgnored` method in `AppProvider`, which only existed for the purpose of testing. The test has been changed to instead check for apps which would end up in the "can update" list (which is really where the "ignored" apps are useful).
This commit is contained in:
@@ -16,7 +16,8 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
@Config(constants = BuildConfig.class, application = Application.class)
|
||||
// TODO: Use sdk=24 when Robolectric supports this
|
||||
@Config(constants = BuildConfig.class, application = Application.class, sdk = 23)
|
||||
@RunWith(RobolectricGradleTestRunner.class)
|
||||
public class AppPrefsProviderTest extends FDroidProviderTest {
|
||||
|
||||
|
||||
@@ -170,21 +170,27 @@ public class AppProviderTest extends FDroidProviderTest {
|
||||
assertResultCount(contentResolver, 10, AppProvider.getContentUri(), PROJ);
|
||||
|
||||
String[] projection = {Cols.PACKAGE_NAME};
|
||||
List<App> ignoredApps = AppProvider.Helper.findIgnored(context, projection);
|
||||
List<App> canUpdateApps = AppProvider.Helper.findCanUpdate(context, projection);
|
||||
|
||||
String[] expectedIgnored = {
|
||||
"installed, already latest, ignore all",
|
||||
"installed, already latest, ignore latest",
|
||||
// NOT "installed, already latest, ignore old" - because it
|
||||
// is should only ignore if "ignored version" is >= suggested
|
||||
String[] expectedCanUpdate = {
|
||||
"installed, old version, no ignore",
|
||||
"installed, old version, ignore newer, but not latest",
|
||||
|
||||
// These are ignored because they don't have updates available:
|
||||
// "installed, only one version available",
|
||||
// "installed, already latest, no ignore",
|
||||
// "installed, already latest, ignore old",
|
||||
// "not installed",
|
||||
|
||||
// These four should be ignored due to the app preferences:
|
||||
// "installed, already latest, ignore all",
|
||||
// "installed, already latest, ignore latest",
|
||||
// "installed, old version, ignore all",
|
||||
// "installed, old version, ignore latest",
|
||||
|
||||
"installed, old version, ignore all",
|
||||
"installed, old version, ignore latest",
|
||||
// NOT "installed, old version, ignore newer, but not latest"
|
||||
// for the same reason as above.
|
||||
};
|
||||
|
||||
assertContainsOnlyIds(ignoredApps, expectedIgnored);
|
||||
assertContainsOnlyIds(canUpdateApps, expectedCanUpdate);
|
||||
}
|
||||
|
||||
private void assertContainsOnlyIds(List<App> actualApps, String[] expectedIds) {
|
||||
|
||||
Reference in New Issue
Block a user