mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-02-05 20:52:14 -05:00
[db] make repo certs non-null and remove repos without cert
historically, repos were added to the DB without much information and could stay in a broken state until manually removed. If a repo is updating, it should have a cert. So only repos that never did a single index update don't have a cert. Nowadays, this can not happen anymore as we get the repo and its cert before adding it to the DB. So whenever we update a repo, we know its certificate and fingerprint. Thus, this includes a DB migration removing all broken repos and making the certificate for repos in the DB non-null.
This commit is contained in:
committed by
Hans-Christoph Steiner
parent
5cf22c5e06
commit
fa65084e60
@@ -27,25 +27,25 @@ internal class DbV2StreamReceiverTest {
|
||||
timestamp = 42L,
|
||||
)
|
||||
every { db.getRepositoryDao() } returns mockk(relaxed = true)
|
||||
dbV2StreamReceiver.receive(repoV2, 42L, "cert")
|
||||
dbV2StreamReceiver.receive(repoV2, 42L)
|
||||
|
||||
// icon file without leading / does not pass
|
||||
val repoV2NoSlash =
|
||||
repoV2.copy(icon = mapOf("en" to FileV2(name = "foo", sha256 = "bar", size = 23L)))
|
||||
assertFailsWith<SerializationException> {
|
||||
dbV2StreamReceiver.receive(repoV2NoSlash, 42L, "cert")
|
||||
dbV2StreamReceiver.receive(repoV2NoSlash, 42L)
|
||||
}
|
||||
|
||||
// icon file without sha256 hash fails
|
||||
val repoNoSha256 = repoV2.copy(icon = mapOf("en" to FileV2(name = "/foo", size = 23L)))
|
||||
assertFailsWith<SerializationException> {
|
||||
dbV2StreamReceiver.receive(repoNoSha256, 42L, "cert")
|
||||
dbV2StreamReceiver.receive(repoNoSha256, 42L)
|
||||
}
|
||||
|
||||
// icon file without size fails
|
||||
val repoNoSize = repoV2.copy(icon = mapOf("en" to FileV2(name = "/foo", sha256 = "bar")))
|
||||
assertFailsWith<SerializationException> {
|
||||
dbV2StreamReceiver.receive(repoNoSize, 42L, "cert")
|
||||
dbV2StreamReceiver.receive(repoNoSize, 42L)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user