panic: add destructive option to reset repos to defaults

This commit is contained in:
Hans-Christoph Steiner
2019-05-29 21:00:41 +02:00
parent 72f5398b79
commit 3b53af0657
9 changed files with 121 additions and 13 deletions

View File

@@ -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);
}
}

View File

@@ -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));

View File

@@ -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();