PiracyChecker icon indicating copy to clipboard operation
PiracyChecker copied to clipboard

AndroidTest UnauthorizedAppTest: Fails due to PiracyCheckerError enum return value not PIRATE_APP_INSTALLED but BLOCK_PIRATE_APP.

Open GerritDeMeulder opened this issue 7 years ago • 1 comments

  • [ x] I have verified there are no duplicate active or recent bugs, questions, or requests.
  • [ x] I have verified that I am using the latest version of PiracyChecker.
  • [ x] I have given my issue a non-generic title.
  • [ x] I have read over the documentation (before asking questions on how to do something).
Details
  • PiracyChecker version: 1.2.3
  • Device OS version: emulator
  • Device Manufacturer: N/A
  • Device Name: Nexus 5
Reproduction Steps

As says UnauthorizedAppTest: /**

    1. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests. */
  1. install apk for unauthorized app (i.e. Lucky patch 7.4.2)
  2. Run test
  3. Test fails with message "PiracyChecker FAILED : PiracyCheckError is not At least one pirate app has been detected and the app must be reinstalled when all unauthorized apps are uninstalled.."

Possible Solution :

  @Test
  public void verifyUnauthorizedApps_DONTALLOW() throws Throwable {
    final CountDownLatch signal = new CountDownLatch(1);
    uiThreadTestRule.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        new PiracyChecker(InstrumentationRegistry.getTargetContext())
            .enableUnauthorizedAppsCheck(true)
            .blockIfUnauthorizedAppUninstalled("piracychecker_preferences", "app_unauthorized")
            .callback(new PiracyCheckerCallback() {
              @Override
              public void allow() {
                assertTrue("PiracyChecker FAILED: There is an unauthorized app installed.", false);
                signal.countDown();
              }

              @Override
              public void dontAllow(@NonNull PiracyCheckerError error, @Nullable PirateApp app) {
                if (error == PiracyCheckerError.PIRATE_APP_INSTALLED
                    || error == PiracyCheckerError.BLOCK_PIRATE_APP) {
...

so add || error == PiracyCheckerError.BLOCK_PIRATE_APP.

NB : same probably holds true for verifyUnauthorizedCustomApp_DONTALLOW test method, but that test doesn't fail.

GerritDeMeulder avatar Sep 20 '18 10:09 GerritDeMeulder

what is password for sampleunauthorizedapp.zip ?

apkunpacker avatar Jan 19 '19 15:01 apkunpacker