{"action":"created","comment":{"url":"https://api.github.com/repos/dimagi/commcare-core/pulls/comments/77994836","id":77994836,"diff_hunk":"@@ -30,23 +33,37 @@ public MockApp(String resourcePath) throws Exception {\n         if(!(resourcePath.startsWith(\"/\") && resourcePath.endsWith(\"/\"))) {\n             throw new IllegalArgumentException(\"Invalid resource path for a mock app \" + resourcePath);\n         }\n+        APP_BASE = resourcePath;\n         LivePrototypeFactory mPrototypeFactory = setupStaticStorage();\n         MockUserDataSandbox mSandbox = new MockUserDataSandbox(mPrototypeFactory);\n         CommCareConfigEngine mEngine = new CommCareConfigEngine(mPrototypeFactory);\n \n-        mEngine.installAppFromReference(\"jr://resource\" + resourcePath + \"profile.ccpr\");\n+        mEngine.installAppFromReference(\"jr://resource\" + APP_BASE + \"profile.ccpr\");\n         mEngine.initEnvironment();\n-        ParseUtils.parseIntoSandbox(this.getClass().getResourceAsStream(resourcePath + \"user_restore.xml\"), mSandbox);\n+        ParseUtils.parseIntoSandbox(this.getClass().getResourceAsStream(APP_BASE + \"user_restore.xml\"), mSandbox);\n \n         //If we parsed in a user, arbitrarily log one in.\n-        for(IStorageIterator<User> iterator = mSandbox.getUserStorage().iterate(); iterator.hasMore();) {\n-            mSandbox.setLoggedInUser(iterator.nextRecord());\n-            break;\n-        }\n+        mSandbox.setLoggedInUser(mSandbox.getUserStorage().read(0));\n \n         mSessionWrapper = new SessionWrapper(mEngine.getPlatform(), mSandbox);\n     }\n \n+    /**\n+     * Loads the provided form and properly initializes external data instances,\n+     * such as the casedb and commcare session.\n+     */\n+    public FormParseInit loadAndInitForm(String formFileInApp) {","path":"tests/test/org/commcare/test/utilities/MockApp.java","position":51,"original_position":51,"commit_id":"46dd46ffe37c4d1b3c6976b4b9b16f21c8e23780","original_commit_id":"46dd46ffe37c4d1b3c6976b4b9b16f21c8e23780","user":{"login":"phillipm","id":94817,"avatar_url":"https://avatars.githubusercontent.com/u/94817?v=3","gravatar_id":"","url":"https://api.github.com/users/phillipm","html_url":"https://github.com/phillipm","followers_url":"https://api.github.com/users/phillipm/followers","following_url":"https://api.github.com/users/phillipm/following{/other_user}","gists_url":"https://api.github.com/users/phillipm/gists{/gist_id}","starred_url":"https://api.github.com/users/phillipm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phillipm/subscriptions","organizations_url":"https://api.github.com/users/phillipm/orgs","repos_url":"https://api.github.com/users/phillipm/repos","events_url":"https://api.github.com/users/phillipm/events{/privacy}","received_events_url":"https://api.github.com/users/phillipm/received_events","type":"User","site_admin":false},"body":"Not used now that I found a minimal test case, but it was helpful in copying a form and user restore from HQ and loading all that data into a `commcare-core` level test. Leaving it here in hopes that we use it soon. Also willing to delete it if that sounds better.","created_at":"2016-09-08T12:22:06Z","updated_at":"2016-09-08T12:22:06Z","html_url":"https://github.com/dimagi/commcare-core/pull/395#discussion_r77994836","pull_request_url":"https://api.github.com/repos/dimagi/commcare-core/pulls/395","_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-core/pulls/comments/77994836"},"html":{"href":"https://github.com/dimagi/commcare-core/pull/395#discussion_r77994836"},"pull_request":{"href":"https://api.github.com/repos/dimagi/commcare-core/pulls/395"}}},"pull_request":{"url":"https://api.github.com/repos/dimagi/commcare-core/pulls/395","id":84466256,"html_url":"https://github.com/dimagi/commcare-core/pull/395","diff_url":"https://github.com/dimagi/commcare-core/pull/395.diff","patch_url":"https://github.com/dimagi/commcare-core/pull/395.patch","issue_url":"https://api.github.com/repos/dimagi/commcare-core/issues/395","number":395,"state":"open","locked":false,"title":"Properly consider group relevancy condition in a repeat while creating triggerable DAG","user":{"login":"phillipm","id":94817,"avatar_url":"https://avatars.githubusercontent.com/u/94817?v=3","gravatar_id":"","url":"https://api.github.com/users/phillipm","html_url":"https://github.com/phillipm","followers_url":"https://api.github.com/users/phillipm/followers","following_url":"https://api.github.com/users/phillipm/following{/other_user}","gists_url":"https://api.github.com/users/phillipm/gists{/gist_id}","starred_url":"https://api.github.com/users/phillipm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phillipm/subscriptions","organizations_url":"https://api.github.com/users/phillipm/orgs","repos_url":"https://api.github.com/users/phillipm/repos","events_url":"https://api.github.com/users/phillipm/events{/privacy}","received_events_url":"https://api.github.com/users/phillipm/received_events","type":"User","site_admin":false},"body":"Fix for http://manage.dimagi.com/default.asp?236848","created_at":"2016-09-08T12:16:42Z","updated_at":"2016-09-08T12:22:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c9090a991aa8e96a5d7163897c41e51a815657c6","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/dimagi/commcare-core/milestones/9","html_url":"https://github.com/dimagi/commcare-core/milestones/commcare_2.31","labels_url":"https://api.github.com/repos/dimagi/commcare-core/milestones/9/labels","id":1985812,"number":9,"title":"commcare_2.31","description":null,"creator":{"login":"phillipm","id":94817,"avatar_url":"https://avatars.githubusercontent.com/u/94817?v=3","gravatar_id":"","url":"https://api.github.com/users/phillipm","html_url":"https://github.com/phillipm","followers_url":"https://api.github.com/users/phillipm/followers","following_url":"https://api.github.com/users/phillipm/following{/other_user}","gists_url":"https://api.github.com/users/phillipm/gists{/gist_id}","starred_url":"https://api.github.com/users/phillipm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phillipm/subscriptions","organizations_url":"https://api.github.com/users/phillipm/orgs","repos_url":"https://api.github.com/users/phillipm/repos","events_url":"https://api.github.com/users/phillipm/events{/privacy}","received_events_url":"https://api.github.com/users/phillipm/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":2,"state":"open","created_at":"2016-09-06T10:06:44Z","updated_at":"2016-09-08T12:16:42Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/dimagi/commcare-core/pulls/395/commits","review_comments_url":"https://api.github.com/repos/dimagi/commcare-core/pulls/395/comments","review_comment_url":"https://api.github.com/repos/dimagi/commcare-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dimagi/commcare-core/issues/395/comments","statuses_url":"https://api.github.com/repos/dimagi/commcare-core/statuses/46dd46ffe37c4d1b3c6976b4b9b16f21c8e23780","head":{"label":"dimagi:refresh-bug","ref":"refresh-bug","sha":"46dd46ffe37c4d1b3c6976b4b9b16f21c8e23780","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":20939782,"name":"commcare-core","full_name":"dimagi/commcare-core","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-core","description":"Last-mile mobile app platform utilized across sectors, from healthcare to supply and logistics","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-core","forks_url":"https://api.github.com/repos/dimagi/commcare-core/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-core/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-core/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-core/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-core/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-core/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-core/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-core/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-core/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-core/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-core/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-core/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-core/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-core/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/commcare-core/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-core/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-core/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-core/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-core/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-core/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-core/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-core/releases{/id}","deployments_url":"https://api.github.com/repos/dimagi/commcare-core/deployments","created_at":"2014-06-17T21:13:25Z","updated_at":"2016-06-26T22:32:46Z","pushed_at":"2016-09-08T12:16:44Z","git_url":"git://github.com/dimagi/commcare-core.git","ssh_url":"git@github.com:dimagi/commcare-core.git","clone_url":"https://github.com/dimagi/commcare-core.git","svn_url":"https://github.com/dimagi/commcare-core","homepage":"http://www.dimagi.com/products/","size":20399,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":6,"forks":6,"open_issues":6,"watchers":2,"default_branch":"master"}},"base":{"label":"dimagi:master","ref":"master","sha":"a8d2f2deae4cf22234c20f2381b425c2f180825b","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":20939782,"name":"commcare-core","full_name":"dimagi/commcare-core","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-core","description":"Last-mile mobile app platform utilized across sectors, from healthcare to supply and logistics","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-core","forks_url":"https://api.github.com/repos/dimagi/commcare-core/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-core/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-core/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-core/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-core/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-core/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-core/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-core/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-core/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-core/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-core/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-core/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-core/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-core/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/commcare-core/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-core/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-core/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-core/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-core/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-core/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-core/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-core/releases{/id}","deployments_url":"https://api.github.com/repos/dimagi/commcare-core/deployments","created_at":"2014-06-17T21:13:25Z","updated_at":"2016-06-26T22:32:46Z","pushed_at":"2016-09-08T12:16:44Z","git_url":"git://github.com/dimagi/commcare-core.git","ssh_url":"git@github.com:dimagi/commcare-core.git","clone_url":"https://github.com/dimagi/commcare-core.git","svn_url":"https://github.com/dimagi/commcare-core","homepage":"http://www.dimagi.com/products/","size":20399,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":6,"forks":6,"open_issues":6,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-core/pulls/395"},"html":{"href":"https://github.com/dimagi/commcare-core/pull/395"},"issue":{"href":"https://api.github.com/repos/dimagi/commcare-core/issues/395"},"comments":{"href":"https://api.github.com/repos/dimagi/commcare-core/issues/395/comments"},"review_comments":{"href":"https://api.github.com/repos/dimagi/commcare-core/pulls/395/comments"},"review_comment":{"href":"https://api.github.com/repos/dimagi/commcare-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dimagi/commcare-core/pulls/395/commits"},"statuses":{"href":"https://api.github.com/repos/dimagi/commcare-core/statuses/46dd46ffe37c4d1b3c6976b4b9b16f21c8e23780"}}}}
{"actor":{"display_login":"phillipm"}}