{"action":"created","comment":{"url":"https://api.github.com/repos/appium/appium-android-driver/pulls/comments/35995601","id":35995601,"diff_hunk":"@@ -39,7 +44,233 @@ describe('Android Helpers', () => {\n       mocks.teen_process.verify();\n     });\n   }));\n+  describe('prepareEmulator', withMocks({adb}, (mocks) => {\n+    const opts = {avd: \"foo@bar\", avdArgs: \"\", language: \"en\", locale: \"us\"};\n+    it('should not launch avd if one is already running', async () => {\n+      mocks.adb.expects('getRunningAVD').withExactArgs('foobar')\n+        .returns(\"foo\");\n+      await helpers.prepareEmulator(adb, opts);\n+      mocks.adb.verify();\n+    });\n+    it('should launch avd if one is already running', async () => {\n+      mocks.adb.expects('getRunningAVD').withExactArgs('foobar')\n+        .returns(null);\n+      mocks.adb.expects('launchAVD').withExactArgs('foo@bar', '', 'en', 'us',\n+        undefined, undefined)\n+        .returns(\"\");\n+      await helpers.prepareEmulator(adb, opts);\n+      mocks.adb.verify();\n+    });\n+  }));\n+  describe('ensureDeviceLocale', withMocks({adb}, (mocks) => {\n+    it('should return if language and locale are not passed', async () => {\n+      mocks.adb.expects('getDeviceLanguage').never();\n+      mocks.adb.expects('getDeviceCountry').never();\n+      mocks.adb.expects('setDeviceLanguage').never();\n+      mocks.adb.expects('setDeviceCountry').never();\n+      mocks.adb.expects('reboot').never();\n+      await helpers.ensureDeviceLocale(adb);\n+      mocks.adb.verify();\n+    });\n+    it('should not set language and locale if it does not change', async () => {\n+      mocks.adb.expects('getDeviceLanguage').returns('en');\n+      mocks.adb.expects('getDeviceCountry').returns('us');\n+      mocks.adb.expects('setDeviceLanguage').never();\n+      mocks.adb.expects('setDeviceCountry').never();\n+      mocks.adb.expects('reboot').never();\n+      await helpers.ensureDeviceLocale(adb, 'en', 'us');\n+      mocks.adb.verify();\n+    });\n+    it('should set language and locale if they are different', async () => {\n+      mocks.adb.expects('getDeviceLanguage').returns('fr');\n+      mocks.adb.expects('getDeviceCountry').returns('FR');\n+      mocks.adb.expects('setDeviceLanguage').withExactArgs('en')\n+        .returns(\"\");\n+      mocks.adb.expects('setDeviceCountry').withExactArgs('us')\n+        .returns(\"\");\n+      mocks.adb.expects('reboot').returns(null);\n+      await helpers.ensureDeviceLocale(adb, 'en', 'us');\n+      mocks.adb.verify();\n+    });\n+  }));\n+  describe('getActiveDevice', withMocks({adb}, (mocks) => {\n+    it('should throw error when udid not in list', async () => {\n+      mocks.adb.expects('getDevicesWithRetry').withExactArgs()\n+        .returns([\"foo\"]);\n+      await helpers.getActiveDevice(adb, \"bar\").should.eventually\n+        .be.rejectedWith(\"bar\");\n+      mocks.adb.verify();\n+    });\n+    it('should get deviceId and emPort when udid is present', async () => {\n+      mocks.adb.expects('getDevicesWithRetry').withExactArgs()\n+        .returns([{udid: 'emulator-1234'}]);\n+      (await helpers.getActiveDevice(adb, \"emulator-1234\")).should.deep\n+        .equal({ deviceId: 'emulator-1234', emPort: 1234 });\n+      mocks.adb.verify();\n+    });\n+    it('should get first deviceId and emPort', async () => {\n+      mocks.adb.expects('getDevicesWithRetry').withExactArgs()\n+        .returns([{udid: 'emulator-1234'}, {udid: 'emulator2-2345'}]);\n+      (await helpers.getActiveDevice(adb)).should.deep\n+        .equal({ deviceId: 'emulator-1234', emPort: 1234 });\n+      mocks.adb.verify();\n+    });\n+  }));\n+  describe('getLaunchInfoFromManifest', withMocks({adb}, (mocks) => {\n+    it('should return when no app present', async () => {\n+      mocks.adb.expects('packageAndLaunchActivityFromManifest').never();\n+      await helpers.getLaunchInfoFromManifest(adb, {});\n+      mocks.adb.verify();\n+    });\n+    it('should return when appPackage & appActivity are already present',\n+      async () => {\n+        mocks.adb.expects('packageAndLaunchActivityFromManifest').never();\n+        await helpers.getLaunchInfoFromManifest(adb, {app: \"foo\", appPackage: \"bar\",\n+          appActivity: \"act\"});\n+        mocks.adb.verify();\n+    });\n+    it('should return package and launch activity from moanifest', async () => {\n+      mocks.adb.expects('packageAndLaunchActivityFromManifest').withExactArgs('foo')\n+        .returns({apkPackage: 'pkg', apkActivity: 'ack'});\n+      const result = { appPackage: 'pkg', appWaitPackage: 'pkg',\n+                       appActivity: 'ack', appWaitActivity: 'ack' };\n+      (await helpers.getLaunchInfoFromManifest(adb, {app: \"foo\"})).should.deep\n+        .equal(result);\n+      mocks.adb.verify();\n+    });\n+  }));\n+  describe('getRemoteApkPath', () => {\n+    it('should return remote path', () => {\n+      helpers.getRemoteApkPath('foo').should.equal(path.resolve(REMOTE_TEMP_PATH,\n+        'foo.apk'));\n+    });\n+  });\n+  describe('resetApp', withMocks({adb, fs, helpers}, (mocks) => {\n+    const localApkPath = 'local',\n+          pkg = 'pkg';\n+    it('should throw error if remote file does not exist', async () => {\n+      mocks.fs.expects('md5').withExactArgs(localApkPath).returns('apkmd5');\n+      mocks.adb.expects('fileExists').returns(false);\n+      mocks.helpers.expects('reinstallRemoteApk').never();\n+      await helpers.resetApp(adb, localApkPath, pkg, false).should.eventually\n+        .be.rejectedWith('slow');\n+      mocks.adb.verify();\n+      mocks.fs.verify();\n+      mocks.helpers.verify();\n+    });\n+    it('should throw error if remote file does not exist', async () => {\n+      mocks.fs.expects('md5').withExactArgs(localApkPath).returns('apkmd5');\n+      mocks.adb.expects('fileExists').returns(true);\n+      mocks.helpers.expects('reinstallRemoteApk').once().returns('');\n+      await helpers.resetApp(adb, localApkPath, pkg, false);\n+      mocks.adb.verify();\n+      mocks.fs.verify();\n+      mocks.helpers.verify();\n+    });\n+  }));\n \n-\n-\n+  describe.skip('reinstallRemoteApk', withMocks({adb}, (mocks) => {","path":"test/unit/android-helper-specs.js","position":157,"original_position":157,"commit_id":"a56cb6d383d69167fbef3986869cbca1f47d40b9","original_commit_id":"a56cb6d383d69167fbef3986869cbca1f47d40b9","user":{"login":"Jonahss","id":1521841,"avatar_url":"https://avatars.githubusercontent.com/u/1521841?v=3","gravatar_id":"","url":"https://api.github.com/users/Jonahss","html_url":"https://github.com/Jonahss","followers_url":"https://api.github.com/users/Jonahss/followers","following_url":"https://api.github.com/users/Jonahss/following{/other_user}","gists_url":"https://api.github.com/users/Jonahss/gists{/gist_id}","starred_url":"https://api.github.com/users/Jonahss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jonahss/subscriptions","organizations_url":"https://api.github.com/users/Jonahss/orgs","repos_url":"https://api.github.com/users/Jonahss/repos","events_url":"https://api.github.com/users/Jonahss/events{/privacy}","received_events_url":"https://api.github.com/users/Jonahss/received_events","type":"User","site_admin":false},"body":"`.skip`?","created_at":"2015-07-31T17:30:06Z","updated_at":"2015-07-31T17:30:06Z","html_url":"https://github.com/appium/appium-android-driver/pull/2#discussion_r35995601","pull_request_url":"https://api.github.com/repos/appium/appium-android-driver/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/comments/35995601"},"html":{"href":"https://github.com/appium/appium-android-driver/pull/2#discussion_r35995601"},"pull_request":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/appium/appium-android-driver/pulls/2","id":41315148,"html_url":"https://github.com/appium/appium-android-driver/pull/2","diff_url":"https://github.com/appium/appium-android-driver/pull/2.diff","patch_url":"https://github.com/appium/appium-android-driver/pull/2.patch","issue_url":"https://api.github.com/repos/appium/appium-android-driver/issues/2","number":2,"state":"open","locked":false,"title":"Adding unit tests for helper","user":{"login":"moizjv","id":1308607,"avatar_url":"https://avatars.githubusercontent.com/u/1308607?v=3","gravatar_id":"","url":"https://api.github.com/users/moizjv","html_url":"https://github.com/moizjv","followers_url":"https://api.github.com/users/moizjv/followers","following_url":"https://api.github.com/users/moizjv/following{/other_user}","gists_url":"https://api.github.com/users/moizjv/gists{/gist_id}","starred_url":"https://api.github.com/users/moizjv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moizjv/subscriptions","organizations_url":"https://api.github.com/users/moizjv/orgs","repos_url":"https://api.github.com/users/moizjv/repos","events_url":"https://api.github.com/users/moizjv/events{/privacy}","received_events_url":"https://api.github.com/users/moizjv/received_events","type":"User","site_admin":false},"body":"- @jlipps @Jonahss please review\r\n","created_at":"2015-07-31T07:50:17Z","updated_at":"2015-07-31T17:30:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3525c671125e46e80192bdcca0eeca41681cea36","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/appium/appium-android-driver/pulls/2/commits","review_comments_url":"https://api.github.com/repos/appium/appium-android-driver/pulls/2/comments","review_comment_url":"https://api.github.com/repos/appium/appium-android-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appium/appium-android-driver/issues/2/comments","statuses_url":"https://api.github.com/repos/appium/appium-android-driver/statuses/a56cb6d383d69167fbef3986869cbca1f47d40b9","head":{"label":"moizjv:master","ref":"master","sha":"a56cb6d383d69167fbef3986869cbca1f47d40b9","user":{"login":"moizjv","id":1308607,"avatar_url":"https://avatars.githubusercontent.com/u/1308607?v=3","gravatar_id":"","url":"https://api.github.com/users/moizjv","html_url":"https://github.com/moizjv","followers_url":"https://api.github.com/users/moizjv/followers","following_url":"https://api.github.com/users/moizjv/following{/other_user}","gists_url":"https://api.github.com/users/moizjv/gists{/gist_id}","starred_url":"https://api.github.com/users/moizjv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moizjv/subscriptions","organizations_url":"https://api.github.com/users/moizjv/orgs","repos_url":"https://api.github.com/users/moizjv/repos","events_url":"https://api.github.com/users/moizjv/events{/privacy}","received_events_url":"https://api.github.com/users/moizjv/received_events","type":"User","site_admin":false},"repo":{"id":39916513,"name":"appium-android-driver","full_name":"moizjv/appium-android-driver","owner":{"login":"moizjv","id":1308607,"avatar_url":"https://avatars.githubusercontent.com/u/1308607?v=3","gravatar_id":"","url":"https://api.github.com/users/moizjv","html_url":"https://github.com/moizjv","followers_url":"https://api.github.com/users/moizjv/followers","following_url":"https://api.github.com/users/moizjv/following{/other_user}","gists_url":"https://api.github.com/users/moizjv/gists{/gist_id}","starred_url":"https://api.github.com/users/moizjv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moizjv/subscriptions","organizations_url":"https://api.github.com/users/moizjv/orgs","repos_url":"https://api.github.com/users/moizjv/repos","events_url":"https://api.github.com/users/moizjv/events{/privacy}","received_events_url":"https://api.github.com/users/moizjv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/moizjv/appium-android-driver","description":"Android Driver for Appium","fork":true,"url":"https://api.github.com/repos/moizjv/appium-android-driver","forks_url":"https://api.github.com/repos/moizjv/appium-android-driver/forks","keys_url":"https://api.github.com/repos/moizjv/appium-android-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moizjv/appium-android-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moizjv/appium-android-driver/teams","hooks_url":"https://api.github.com/repos/moizjv/appium-android-driver/hooks","issue_events_url":"https://api.github.com/repos/moizjv/appium-android-driver/issues/events{/number}","events_url":"https://api.github.com/repos/moizjv/appium-android-driver/events","assignees_url":"https://api.github.com/repos/moizjv/appium-android-driver/assignees{/user}","branches_url":"https://api.github.com/repos/moizjv/appium-android-driver/branches{/branch}","tags_url":"https://api.github.com/repos/moizjv/appium-android-driver/tags","blobs_url":"https://api.github.com/repos/moizjv/appium-android-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moizjv/appium-android-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moizjv/appium-android-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/moizjv/appium-android-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moizjv/appium-android-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/moizjv/appium-android-driver/languages","stargazers_url":"https://api.github.com/repos/moizjv/appium-android-driver/stargazers","contributors_url":"https://api.github.com/repos/moizjv/appium-android-driver/contributors","subscribers_url":"https://api.github.com/repos/moizjv/appium-android-driver/subscribers","subscription_url":"https://api.github.com/repos/moizjv/appium-android-driver/subscription","commits_url":"https://api.github.com/repos/moizjv/appium-android-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/moizjv/appium-android-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/moizjv/appium-android-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/moizjv/appium-android-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/moizjv/appium-android-driver/contents/{+path}","compare_url":"https://api.github.com/repos/moizjv/appium-android-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moizjv/appium-android-driver/merges","archive_url":"https://api.github.com/repos/moizjv/appium-android-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moizjv/appium-android-driver/downloads","issues_url":"https://api.github.com/repos/moizjv/appium-android-driver/issues{/number}","pulls_url":"https://api.github.com/repos/moizjv/appium-android-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/moizjv/appium-android-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/moizjv/appium-android-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moizjv/appium-android-driver/labels{/name}","releases_url":"https://api.github.com/repos/moizjv/appium-android-driver/releases{/id}","created_at":"2015-07-29T21:10:05Z","updated_at":"2015-07-29T21:10:06Z","pushed_at":"2015-07-31T07:48:28Z","git_url":"git://github.com/moizjv/appium-android-driver.git","ssh_url":"git@github.com:moizjv/appium-android-driver.git","clone_url":"https://github.com/moizjv/appium-android-driver.git","svn_url":"https://github.com/moizjv/appium-android-driver","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"appium:master","ref":"master","sha":"042a6ef38b6bd95e29880afc5567fa73330326fe","user":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"repo":{"id":39916403,"name":"appium-android-driver","full_name":"appium/appium-android-driver","owner":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appium/appium-android-driver","description":"Android Driver for Appium","fork":false,"url":"https://api.github.com/repos/appium/appium-android-driver","forks_url":"https://api.github.com/repos/appium/appium-android-driver/forks","keys_url":"https://api.github.com/repos/appium/appium-android-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-android-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-android-driver/teams","hooks_url":"https://api.github.com/repos/appium/appium-android-driver/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-android-driver/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-android-driver/events","assignees_url":"https://api.github.com/repos/appium/appium-android-driver/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-android-driver/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-android-driver/tags","blobs_url":"https://api.github.com/repos/appium/appium-android-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-android-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-android-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-android-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-android-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-android-driver/languages","stargazers_url":"https://api.github.com/repos/appium/appium-android-driver/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-android-driver/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-android-driver/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-android-driver/subscription","commits_url":"https://api.github.com/repos/appium/appium-android-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-android-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-android-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-android-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/appium/appium-android-driver/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-android-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-android-driver/merges","archive_url":"https://api.github.com/repos/appium/appium-android-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-android-driver/downloads","issues_url":"https://api.github.com/repos/appium/appium-android-driver/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-android-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-android-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-android-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-android-driver/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-android-driver/releases{/id}","created_at":"2015-07-29T21:07:42Z","updated_at":"2015-07-29T21:09:08Z","pushed_at":"2015-07-31T07:50:17Z","git_url":"git://github.com/appium/appium-android-driver.git","ssh_url":"git@github.com:appium/appium-android-driver.git","clone_url":"https://github.com/appium/appium-android-driver.git","svn_url":"https://github.com/appium/appium-android-driver","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/2"},"html":{"href":"https://github.com/appium/appium-android-driver/pull/2"},"issue":{"href":"https://api.github.com/repos/appium/appium-android-driver/issues/2"},"comments":{"href":"https://api.github.com/repos/appium/appium-android-driver/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appium/appium-android-driver/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/appium/appium-android-driver/statuses/a56cb6d383d69167fbef3986869cbca1f47d40b9"}}}}