Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GerritDeMeulder opened this issue Sep 20, 2018 · 1 comment

Comments

@GerritDeMeulder
Copy link

  • [ 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 GerritDeMeulder changed the title AndroidTest 2. UnauthorizedAppTest: Fails due to PiracyCheckerError.PIRATE_APP_INSTALLED but BLOCK_PIRATE_APP AndroidTest UnauthorizedAppTest: Fails due to PiracyCheckerError enum return value not PIRATE_APP_INSTALLED but BLOCK_PIRATE_APP. Sep 20, 2018
GerritDeMeulder added a commit to GerritDeMeulder/PiracyChecker that referenced this issue Sep 20, 2018
Solves : AndroidTest UnauthorizedAppTest: Fails due to PiracyCheckerError enum return value not PIRATE_APP_INSTALLED but BLOCK_PIRATE_APP.
@apkunpacker
Copy link

what is password for sampleunauthorizedapp.zip ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants