Search in sources :

Example 6 with RepoDetails

use of org.fdroid.fdroid.mock.RepoDetails in project fdroidclient by f-droid.

the class RepoXMLHandlerTest method testExtendedPerms.

@Test
public void testExtendedPerms() throws IOException {
    Repo expectedRepo = new Repo();
    expectedRepo.name = "F-Droid";
    // NOCHECKSTYLE LineLength
    expectedRepo.signingCertificate = "3082035e30820246a00302010202044c49cd00300d06092a864886f70d01010505003071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b73301e170d3130303732333137313032345a170d3337313230383137313032345a3071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b7330820122300d06092a864886f70d01010105000382010f003082010a028201010096d075e47c014e7822c89fd67f795d23203e2a8843f53ba4e6b1bf5f2fd0e225938267cfcae7fbf4fe596346afbaf4070fdb91f66fbcdf2348a3d92430502824f80517b156fab00809bdc8e631bfa9afd42d9045ab5fd6d28d9e140afc1300917b19b7c6c4df4a494cf1f7cb4a63c80d734265d735af9e4f09455f427aa65a53563f87b336ca2c19d244fcbba617ba0b19e56ed34afe0b253ab91e2fdb1271f1b9e3c3232027ed8862a112f0706e234cf236914b939bcf959821ecb2a6c18057e070de3428046d94b175e1d89bd795e535499a091f5bc65a79d539a8d43891ec504058acb28c08393b5718b57600a211e803f4a634e5c57f25b9b8c4422c6fd90203010001300d06092a864886f70d0101050500038201010008e4ef699e9807677ff56753da73efb2390d5ae2c17e4db691d5df7a7b60fc071ae509c5414be7d5da74df2811e83d3668c4a0b1abc84b9fa7d96b4cdf30bba68517ad2a93e233b042972ac0553a4801c9ebe07bf57ebe9a3b3d6d663965260e50f3b8f46db0531761e60340a2bddc3426098397fda54044a17e5244549f9869b460ca5e6e216b6f6a2db0580b480ca2afe6ec6b46eedacfa4aa45038809ece0c5978653d6c85f678e7f5a2156d1bedd8117751e64a4b0dcd140f3040b021821a8d93aed8d01ba36db6c82372211fed714d9a32607038cdfd565bd529ffc637212aaa2c224ef22b603eccefb5bf1e085c191d4b24fe742b17ab3f55d4e6f05ef";
    expectedRepo.description = "This is just a test of the extended permissions attributes.";
    expectedRepo.timestamp = 1467169032;
    RepoDetails actualDetails = getFromFile("extendedPerms.xml");
    handlerTestSuite(expectedRepo, actualDetails, 2, 6, 14, 16);
}
Also used : Repo(org.fdroid.fdroid.data.Repo) RepoDetails(org.fdroid.fdroid.mock.RepoDetails) Test(org.junit.Test)

Example 7 with RepoDetails

use of org.fdroid.fdroid.mock.RepoDetails in project fdroidclient by f-droid.

the class RepoXMLHandlerTest method testSimpleIndex.

@Test
public void testSimpleIndex() {
    Repo expectedRepo = new Repo();
    expectedRepo.name = "F-Droid";
    // NOCHECKSTYLE LineLength
    expectedRepo.signingCertificate = "308201ee30820157a0030201020204300d845b300d06092a864886f70d01010b0500302a3110300e060355040b1307462d44726f6964311630140603550403130d70616c6174736368696e6b656e301e170d3134303432373030303633315a170d3431303931323030303633315a302a3110300e060355040b1307462d44726f6964311630140603550403130d70616c6174736368696e6b656e30819f300d06092a864886f70d010101050003818d0030818902818100a439472e4b6d01141bfc94ecfe131c7c728fdda670bb14c57ca60bd1c38a8b8bc0879d22a0a2d0bc0d6fdd4cb98d1d607c2caefbe250a0bd0322aedeb365caf9b236992fac13e6675d3184a6c7c6f07f73410209e399a9da8d5d7512bbd870508eebacff8b57c3852457419434d34701ccbf692267cbc3f42f1c5d1e23762d790203010001a321301f301d0603551d0e041604140b1840691dab909746fde4bfe28207d1cae15786300d06092a864886f70d01010b05000381810062424c928ffd1b6fd419b44daafef01ca982e09341f7077fb865905087aeac882534b3bd679b51fdfb98892cef38b63131c567ed26c9d5d9163afc775ac98ad88c405d211d6187bde0b0d236381cc574ba06ef9080721a92ae5a103a7301b2c397eecc141cc850dd3e123813ebc41c59d31ddbcb6e984168280c53272f6a442b";
    // NOCHECKSTYLE LineLength
    expectedRepo.description = "The official repository of the F-Droid client. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitorious.org/f-droid.";
    expectedRepo.timestamp = 1398733213;
    RepoDetails actualDetails = getFromFile("simpleIndex.xml");
    handlerTestSuite(expectedRepo, actualDetails, 0, 0, -1, 12);
}
Also used : Repo(org.fdroid.fdroid.data.Repo) RepoDetails(org.fdroid.fdroid.mock.RepoDetails) Test(org.junit.Test)

Example 8 with RepoDetails

use of org.fdroid.fdroid.mock.RepoDetails in project fdroidclient by f-droid.

the class RepoXMLHandlerTest method testSmallRepo.

@Test
public void testSmallRepo() {
    Repo expectedRepo = new Repo();
    expectedRepo.name = "Android-Nexus-7-20139453 on UNSET";
    // NOCHECKSTYLE LineLength
    expectedRepo.signingCertificate = "308202da308201c2a00302010202080eb08c796fec91aa300d06092a864886f70d0101050500302d3111300f060355040a0c084b6572706c61707031183016060355040b0c0f477561726469616e50726f6a656374301e170d3134313030333135303631325a170d3135313030333135303631325a302d3111300f060355040a0c084b6572706c61707031183016060355040b0c0f477561726469616e50726f6a65637430820122300d06092a864886f70d01010105000382010f003082010a0282010100c7ab44b130be5c00eedcc3625462f6f6ac26e502641cd641f3e30cbb0ff1ba325158611e7fc2448a35b6a6df30dc6e23602cf6909448befcf11e2fe486b580f1e76fe5887d159050d00afd2c4079f6538896bb200627f4b3e874f011ce5df0fef5d150fcb0b377b531254e436eaf4083ea72fe3b8c3ef450789fa858f2be8f6c5335bb326aff3dda689fbc7b5ba98dea53651dbea7452c38d294985ac5dd8a9e491a695de92c706d682d6911411fcaef3b0a08a030fe8a84e47acaab0b7edcda9d190ce39e810b79b1d8732eca22b15f0d048c8d6f00503a7ee81ab6e08919ff465883432304d95238b95e95c5f74e0a421809e2a6a85825aed680e0d6939e8f0203010001300d06092a864886f70d010105050003820101006d17aad3271b8b2c299dbdb7b1182849b0d5ddb9f1016dcb3487ae0db02b6be503344c7d066e2050bcd01d411b5ee78c7ed450f0ff9da5ce228f774cbf41240361df53d9c6078159d16f4d34379ab7dedf6186489397c83b44b964251a2ebb42b7c4689a521271b1056d3b5a5fa8f28ba64fb8ce5e2226c33c45d27ba3f632dc266c12abf582b8438c2abcf3eae9de9f31152b4158ace0ef33435c20eb809f1b3988131db6e5a1442f2617c3491d9565fedb3e320e8df4236200d3bd265e47934aa578f84d0d1a5efeb49b39907e876452c46996d0feff9404b41aa5631b4482175d843d5512ded45e12a514690646492191e7add434afce63dbff8f0b03ec0c";
    expectedRepo.description = "A local FDroid repo generated from apps installed on Android-Nexus-7-20139453";
    expectedRepo.timestamp = 1412696461;
    RepoDetails actualDetails = getFromFile("smallRepo.xml");
    handlerTestSuite(expectedRepo, actualDetails, 12, 12, 14, -1);
    checkIncludedApps(actualDetails.apps, new String[] { "org.mozilla.firefox", "com.koushikdutta.superuser", "info.guardianproject.courier", "org.adaway", "info.guardianproject.gilga", "com.google.zxing.client.android", "info.guardianproject.lildebi", "de.danoeh.antennapod", "info.guardianproject.otr.app.im", "org.torproject.android", "org.gege.caldavsyncadapter", "info.guardianproject.checkey" });
}
Also used : Repo(org.fdroid.fdroid.data.Repo) RepoDetails(org.fdroid.fdroid.mock.RepoDetails) Test(org.junit.Test)

Example 9 with RepoDetails

use of org.fdroid.fdroid.mock.RepoDetails in project fdroidclient by f-droid.

the class RepoXMLHandlerTest method testPushRequestsRepoAlways.

@Test
public void testPushRequestsRepoAlways() {
    Repo expectedRepo = new Repo();
    expectedRepo.name = "non-public test repo";
    // NOCHECKSTYLE LineLength
    expectedRepo.signingCertificate = "308204e1308202c9a0030201020204483450fa300d06092a864886f70d01010b050030213110300e060355040b1307462d44726f6964310d300b06035504031304736f7661301e170d3136303832333133333131365a170d3434303130393133333131365a30213110300e060355040b1307462d44726f6964310d300b06035504031304736f766130820222300d06092a864886f70d01010105000382020f003082020a0282020100dfdcd120f3ab224999dddf4ea33ea588d295e4d7130bef48c143e9d76e5c0e0e9e5d45e64208e35feebc79a83f08939dd6a343b7d1e2179930a105a1249ccd36d88ff3feffc6e4dc53dae0163a7876dd45ecc1ddb0adf5099aa56c1a84b52affcd45d0711ffa4de864f35ac0333ebe61ea8673eeda35a88f6af678cc4d0f80b089338ac8f2a8279a64195c611d19445cab3fd1a020afed9bd739bb95142fb2c00a8f847db5ef3325c814f8eb741bacf86ed3907bfe6e4564d2de5895df0c263824e0b75407589bae2d3a4666c13b92102d8781a8ee9bb4a5a1a78c4a9c21efdaf5584da42e84418b28f5a81d0456a3dc5b420991801e6b21e38c99bbe018a5b2d690894a114bc860d35601416aa4dc52216aff8a288d4775cddf8b72d45fd2f87303a8e9c0d67e442530be28eaf139894337266e0b33d57f949256ab32083bcc545bc18a83c9ab8247c12aea037e2b68dee31c734cb1f04f241d3b94caa3a2b258ffaf8e6eae9fbbe029a934dc0a0859c5f120334812693a1c09352340a39f2a678dbc1afa2a978bfee43afefcb7e224a58af2f3d647e5745db59061236b8af6fcfd93b3602f9e456978534f3a7851e800071bf56da80401c81d91c45f82568373af0576b1cc5eef9b85654124b6319770be3cdba3fbebe3715e8918fb6c8966624f3d0e815effac3d2ee06dd34ab9c693218b2c7c06ba99d6b74d4f17b8c3cb0203010001a321301f301d0603551d0e04160414d62bee9f3798509546acc62eb1de14b08b954d4f300d06092a864886f70d01010b05000382020100743f7c5692085895f9d1fffad390fb4202c15f123ed094df259185960fd6dadf66cb19851070f180297bba4e6996a4434616573b375cfee94fee73a4505a7ec29136b7e6c22e6436290e3686fe4379d4e3140ec6a08e70cfd3ed5b634a5eb5136efaaabf5f38e0432d3d79568a556970b8cfba2972f5d23a3856d8a981b9e9bbbbb88f35e708bde9cbc5f681cbd974085b9da28911296fe2579fa64bbe9fa0b93475a7a8db051080b0c5fade0d1c018e7858cd4cbe95145b0620e2f632cbe0f8af9cbf22e2fdaa72245ae31b0877b07181cc69dd2df74454251d8de58d25e76354abe7eb690f22e59b08795a8f2c98c578e0599503d9085927634072c82c9f82abd50fd12b8fd1a9d1954eb5cc0b4cfb5796b5aaec0356643b4a65a368442d92ef94edd3ac6a2b7fe3571b8cf9f462729228aab023ef9183f73792f5379633ccac51079177d604c6bc1873ada6f07d8da6d68c897e88a5fa5d63fdb8df820f46090e0716e7562dd3c140ba279a65b996f60addb0abe29d4bf2f5abe89480771d492307b926d91f02f341b2148502903c43d40f3c6c86a811d060711f0698b384acdcc0add44eb54e42962d3d041accc715afd49407715adc09350cb55e8d9281a3b0b6b5fcd91726eede9b7c8b13afdebb2c2b377629595f1096ba62fb14946dbac5f3c5f0b4e5b712e7acc7dcf6c46cdc5e6d6dfdeee55a0c92c2d70f080ac6";
    // NOCHECKSTYLE LineLength
    expectedRepo.description = "This is a repository of apps to be used with F-Droid. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitlab.com/u/fdroid.";
    expectedRepo.timestamp = 1472071347;
    RepoDetails actualDetails = getFromFile("pushRequestsIndex.xml", Repo.PUSH_REQUEST_ACCEPT_ALWAYS);
    handlerTestSuite(expectedRepo, actualDetails, 2, 14, -1, 17);
    checkPushRequests(actualDetails);
    List<RepoPushRequest> repoPushRequests = actualDetails.repoPushRequestList;
    assertNotNull(repoPushRequests);
    assertEquals(6, repoPushRequests.size());
}
Also used : Repo(org.fdroid.fdroid.data.Repo) RepoPushRequest(org.fdroid.fdroid.data.RepoPushRequest) RepoDetails(org.fdroid.fdroid.mock.RepoDetails) Test(org.junit.Test)

Example 10 with RepoDetails

use of org.fdroid.fdroid.mock.RepoDetails in project fdroidclient by f-droid.

the class RepoXMLHandlerTest method testObbIndex.

@Test
public void testObbIndex() throws IOException {
    writeResourceToObbDir("main.1101613.obb.main.twoversions.obb");
    writeResourceToObbDir("main.1101615.obb.main.twoversions.obb");
    writeResourceToObbDir("main.1434483388.obb.main.oldversion.obb");
    writeResourceToObbDir("main.1619.obb.mainpatch.current.obb");
    writeResourceToObbDir("patch.1619.obb.mainpatch.current.obb");
    RepoDetails actualDetails = getFromFile("obbIndex.xml");
    for (Apk indexApk : actualDetails.apks) {
        Apk localApk = new Apk();
        localApk.packageName = indexApk.packageName;
        localApk.versionCode = indexApk.versionCode;
        localApk.hashType = indexApk.hashType;
        App.initInstalledObbFiles(localApk);
        assertEquals(indexApk.obbMainFile, localApk.obbMainFile);
        assertEquals(indexApk.obbMainFileSha256, localApk.obbMainFileSha256);
        assertEquals(indexApk.obbPatchFile, localApk.obbPatchFile);
        assertEquals(indexApk.obbPatchFileSha256, localApk.obbPatchFileSha256);
    }
}
Also used : Apk(org.fdroid.fdroid.data.Apk) RepoDetails(org.fdroid.fdroid.mock.RepoDetails) Test(org.junit.Test)

Aggregations

RepoDetails (org.fdroid.fdroid.mock.RepoDetails)10 Test (org.junit.Test)10 Repo (org.fdroid.fdroid.data.Repo)8 RepoPushRequest (org.fdroid.fdroid.data.RepoPushRequest)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Apk (org.fdroid.fdroid.data.Apk)2 Uri (android.net.Uri)1 JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JsonParser (com.fasterxml.jackson.core.JsonParser)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 FileCompatTest (org.fdroid.fdroid.compat.FileCompatTest)1 App (org.fdroid.fdroid.data.App)1 FDroidProviderTest (org.fdroid.fdroid.data.FDroidProviderTest)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1