panic: add destructive option to reset repos to defaults

This commit is contained in:
Hans-Christoph Steiner committed 2019-06-12 14:48:50 +02:00
1 parent 72f5398b79
commit 3b53af0657
9 files changed
+121 -13

No files matched your search

@@ -1,5 +1,6 @@
package org.fdroid.fdroid.data;
import android.content.ContentValues;
import android.content.ContextWrapper;
import org.fdroid.fdroid.TestUtils;
import org.junit.After;
@@ -26,4 +27,10 @@ public abstract class FDroidProviderTest {
DBHelper.clearDbHelperSingleton();
}
protected Repo setEnabled(Repo repo, boolean enabled) {
ContentValues enable = new ContentValues(1);
enable.put(Schema.RepoTable.Cols.IN_USE, enabled);
RepoProvider.Helper.update(context, repo, enable);
return RepoProvider.Helper.findByAddress(context, repo.address);
}
}
@@ -77,13 +77,6 @@ public class RepoProviderTest extends FDroidProviderTest {
assertEquals(0, RepoProvider.Helper.countEnabledRepos(context));
}
private Repo setEnabled(Repo repo, boolean enabled) {
ContentValues enable = new ContentValues(1);
enable.put(RepoTable.Cols.IN_USE, enabled);
RepoProvider.Helper.update(context, repo, enable);
return RepoProvider.Helper.findByAddress(context, repo.address);
}
@Test
public void lastUpdated() {
assertNull(RepoProvider.Helper.lastUpdate(context));
@@ -35,12 +35,6 @@ public class Issue763MultiRepo extends MultiIndexUpdaterTest {
antoxRepo = createRepo("Tox", "https://pkg.tox.chat/fdroid/repo", context, antoxCert);
}
public void setEnabled(Repo repo, boolean enabled) {
ContentValues values = new ContentValues(1);
values.put(Schema.RepoTable.Cols.IN_USE, enabled ? 1 : 0);
RepoProvider.Helper.update(context, repo, values);
}
@Test
public void antoxRepo() throws IndexUpdater.UpdateException {
assertAntoxEmpty();