This code comes from SearchManager, but making it available in the DB library makes sense since the queries are specific to the DB implementation such as zero-whitespace hack.
We now hang on to the index file while streaming it for repo preview purposes. This avoids having to re-download that file and we can properly add the repo right away.
This then allows us to bring the user to the list of apps in that repository without it being initially empty.
- Rename expectDownloadOfMinRepo() to mockMinRepoDownload() to better describe what it does
- Move repoAdder.fetchRepository into expectMinRepoPreview() to reduce repetition
- Change some remnant example.com to min-v1.org
- Use explicit user-mirror-min-v1.org instead of example.com to make the intention clear
- Add comments to explain what's going on
- Make mockRepoDownload() configurable, to allow easier mocking of other repos in the futures (e.g., of mid and max)
See also fdroid/fdroidclient!1535
This clean up was prompted by the need to write a test for fdroid/fdroidclient!1530
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.
so they do not override the information from older repos anymore. This is especially an issue for the official repo which historically had the lowest priority while it should have the highest.
and remove sharedTest symlink hack. The shared tests are now a proper gradle module to avoid issues with using the same source files in different modules.