{"action":"created","comment":{"url":"https://api.github.com/repos/ga4gh/server/pulls/comments/70581592","id":70581592,"diff_hunk":"@@ -0,0 +1,277 @@\n+\"\"\"\n+Tests the data interfacing layer for various objects\n+\"\"\"\n+from __future__ import division\n+from __future__ import print_function\n+from __future__ import unicode_literals\n+\n+import unittest\n+\n+import ga4gh.client as client\n+import ga4gh.datarepo as datarepo\n+import ga4gh.backend as backend\n+import tests.paths as paths\n+import tests.utils as utils\n+\n+\n+class TestInterfacingLayer(unittest.TestCase):\n+    \"\"\"\n+    Test fetching objects via the db and via the client return\n+    identical results\n+    \"\"\"\n+    def _assertEqual(self, dbObj, pbObj):\n+        dbToPb = dbObj.toProtocolElement()\n+        self.assertEqual(dbToPb, pbObj)\n+\n+    def _getPageSizes(self, num):\n+        return [None, 1, 2, 3, num - 1, num, num + 1]\n+\n+    def _testGetMethod(self, repoIteratorMethod, clientGetMethod):\n+        repoObjs = repoIteratorMethod()\n+        for repoObj in repoObjs:\n+            id_ = repoObj.getId()\n+            clientObj = clientGetMethod(id_)\n+            self._assertEqual(repoObj, clientObj)\n+\n+    def _testSearchMethod(self, repoIteratorMethod, clientSearchMethod):\n+        repoObjs = list(repoIteratorMethod())\n+        numRepoObjs = len(repoObjs)\n+        pageSizes = self._getPageSizes(numRepoObjs)\n+        for pageSize in pageSizes:\n+            self._client.setPageSize(pageSize)\n+            clientObjs = list(clientSearchMethod())\n+            for repoObj, clientObj in utils.zipLists(repoObjs, clientObjs):\n+                self._assertEqual(repoObj, clientObj)\n+\n+    def _testSearchMethodInContainer(\n+            self, containerAccessorMethod, clientSearchMethod,\n+            containerIteratorMethod):\n+        for container in containerIteratorMethod:\n+            containerId = container.getId()\n+            repoObjs = getattr(container, containerAccessorMethod)()\n+            numRepoObjs = len(repoObjs)\n+            if numRepoObjs == 0:\n+                continue\n+            pageSizes = self._getPageSizes(numRepoObjs)\n+            for pageSize in pageSizes:\n+                self._client.setPageSize(pageSize)\n+                clientObjs = list(clientSearchMethod(containerId))\n+                for repoObj, clientObj in utils.zipLists(\n+                        repoObjs, clientObjs):\n+                    self._assertEqual(repoObj, clientObj)\n+\n+    def setUp(self):\n+        self._repo = datarepo.SqlDataRepository(paths.testDataRepo)\n+        self._repo.open(datarepo.MODE_READ)\n+        self._backend = backend.Backend(self._repo)\n+        self._client = client.LocalClient(self._backend)\n+\n+    def testGetBioSample(self):\n+        self._testGetMethod(\n+            self._repo.allBioSamples, self._client.getBioSample)\n+\n+    def testGetIndividual(self):\n+        self._testGetMethod(\n+            self._repo.allIndividuals, self._client.getIndividual)\n+\n+    def testGetDataset(self):\n+        self._testGetMethod(\n+            self._repo.getDatasets, self._client.getDataset)\n+\n+    def testGetReadGroupSet(self):\n+        self._testGetMethod(\n+            self._repo.allReadGroupSets, self._client.getReadGroupSet)\n+\n+    def testGetReadGroup(self):\n+        self._testGetMethod(\n+            self._repo.allReadGroups, self._client.getReadGroup)\n+\n+    def testGetCallSet(self):\n+        self._testGetMethod(\n+            self._repo.allCallSets, self._client.getCallSet)\n+\n+    def testGetVariant(self):\n+        repoVariantSets = self._repo.allVariantSets()\n+        referenceName = self._repo.getReferenceSets(\n+            )[0].getReferences()[0].getName()\n+        for variantSet in repoVariantSets:\n+            repoVariants = variantSet.getVariants(referenceName, 0, 2**32)\n+            for repoVariant in repoVariants:\n+                variantId = repoVariant.getId()\n+                variant = self._client.getVariant(variantId)\n+                self._assertEqual(repoVariant, variant)\n+\n+    def testGetVariantSet(self):\n+        self._testGetMethod(\n+            self._repo.allVariantSets, self._client.getVariantSet)\n+\n+    def testGetVariantAnnotationSet(self):\n+        self._testGetMethod(\n+            self._repo.allVariantAnnotationSets,\n+            self._client.getVariantAnnotationSet)\n+\n+    def testGetFeatureSet(self):\n+        self._testGetMethod(\n+            self._repo.allFeatureSets, self._client.getFeatureSet)\n+\n+    def testGetFeature(self):\n+        repoFeatures = self._repo.allFeatures()\n+        for repoFeature in repoFeatures:\n+            repoFeature = repoFeature[0]","path":"tests/unit/test_data_interface.py","position":120,"original_position":120,"commit_id":"9763b1a9e316a673f3e0f9ebc9de25f1ff2340cc","original_commit_id":"9763b1a9e316a673f3e0f9ebc9de25f1ff2340cc","user":{"login":"jeromekelleher","id":2664569,"avatar_url":"https://avatars.githubusercontent.com/u/2664569?v=3","gravatar_id":"","url":"https://api.github.com/users/jeromekelleher","html_url":"https://github.com/jeromekelleher","followers_url":"https://api.github.com/users/jeromekelleher/followers","following_url":"https://api.github.com/users/jeromekelleher/following{/other_user}","gists_url":"https://api.github.com/users/jeromekelleher/gists{/gist_id}","starred_url":"https://api.github.com/users/jeromekelleher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeromekelleher/subscriptions","organizations_url":"https://api.github.com/users/jeromekelleher/orgs","repos_url":"https://api.github.com/users/jeromekelleher/repos","events_url":"https://api.github.com/users/jeromekelleher/events{/privacy}","received_events_url":"https://api.github.com/users/jeromekelleher/received_events","type":"User","site_admin":false},"body":"This looks odd --- why do we need to do this?","created_at":"2016-07-13T08:09:30Z","updated_at":"2016-07-13T08:09:30Z","html_url":"https://github.com/ga4gh/server/pull/1219#discussion_r70581592","pull_request_url":"https://api.github.com/repos/ga4gh/server/pulls/1219","_links":{"self":{"href":"https://api.github.com/repos/ga4gh/server/pulls/comments/70581592"},"html":{"href":"https://github.com/ga4gh/server/pull/1219#discussion_r70581592"},"pull_request":{"href":"https://api.github.com/repos/ga4gh/server/pulls/1219"}}},"pull_request":{"url":"https://api.github.com/repos/ga4gh/server/pulls/1219","id":69222616,"html_url":"https://github.com/ga4gh/server/pull/1219","diff_url":"https://github.com/ga4gh/server/pull/1219.diff","patch_url":"https://github.com/ga4gh/server/pull/1219.patch","issue_url":"https://api.github.com/repos/ga4gh/server/issues/1219","number":1219,"state":"open","locked":false,"title":"New end-to-end-ish test for references","user":{"login":"dcolligan","id":7422120,"avatar_url":"https://avatars.githubusercontent.com/u/7422120?v=3","gravatar_id":"","url":"https://api.github.com/users/dcolligan","html_url":"https://github.com/dcolligan","followers_url":"https://api.github.com/users/dcolligan/followers","following_url":"https://api.github.com/users/dcolligan/following{/other_user}","gists_url":"https://api.github.com/users/dcolligan/gists{/gist_id}","starred_url":"https://api.github.com/users/dcolligan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcolligan/subscriptions","organizations_url":"https://api.github.com/users/dcolligan/orgs","repos_url":"https://api.github.com/users/dcolligan/repos","events_url":"https://api.github.com/users/dcolligan/events{/privacy}","received_events_url":"https://api.github.com/users/dcolligan/received_events","type":"User","site_admin":false},"body":"Issue #1213 \r\n\r\n@jeromekelleher not at all sure if this is what you were getting at","created_at":"2016-05-06T23:13:01Z","updated_at":"2016-07-13T08:09:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b6656977d031a6730dc554622d02e9d91f70a002","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ga4gh/server/pulls/1219/commits","review_comments_url":"https://api.github.com/repos/ga4gh/server/pulls/1219/comments","review_comment_url":"https://api.github.com/repos/ga4gh/server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ga4gh/server/issues/1219/comments","statuses_url":"https://api.github.com/repos/ga4gh/server/statuses/9763b1a9e316a673f3e0f9ebc9de25f1ff2340cc","head":{"label":"dcolligan:1213_ref_test","ref":"1213_ref_test","sha":"9763b1a9e316a673f3e0f9ebc9de25f1ff2340cc","user":{"login":"dcolligan","id":7422120,"avatar_url":"https://avatars.githubusercontent.com/u/7422120?v=3","gravatar_id":"","url":"https://api.github.com/users/dcolligan","html_url":"https://github.com/dcolligan","followers_url":"https://api.github.com/users/dcolligan/followers","following_url":"https://api.github.com/users/dcolligan/following{/other_user}","gists_url":"https://api.github.com/users/dcolligan/gists{/gist_id}","starred_url":"https://api.github.com/users/dcolligan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcolligan/subscriptions","organizations_url":"https://api.github.com/users/dcolligan/orgs","repos_url":"https://api.github.com/users/dcolligan/repos","events_url":"https://api.github.com/users/dcolligan/events{/privacy}","received_events_url":"https://api.github.com/users/dcolligan/received_events","type":"User","site_admin":false},"repo":{"id":29265238,"name":"server","full_name":"dcolligan/server","owner":{"login":"dcolligan","id":7422120,"avatar_url":"https://avatars.githubusercontent.com/u/7422120?v=3","gravatar_id":"","url":"https://api.github.com/users/dcolligan","html_url":"https://github.com/dcolligan","followers_url":"https://api.github.com/users/dcolligan/followers","following_url":"https://api.github.com/users/dcolligan/following{/other_user}","gists_url":"https://api.github.com/users/dcolligan/gists{/gist_id}","starred_url":"https://api.github.com/users/dcolligan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcolligan/subscriptions","organizations_url":"https://api.github.com/users/dcolligan/orgs","repos_url":"https://api.github.com/users/dcolligan/repos","events_url":"https://api.github.com/users/dcolligan/events{/privacy}","received_events_url":"https://api.github.com/users/dcolligan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dcolligan/server","description":"A reference implementation of the APIs defined in the schemas repository.","fork":true,"url":"https://api.github.com/repos/dcolligan/server","forks_url":"https://api.github.com/repos/dcolligan/server/forks","keys_url":"https://api.github.com/repos/dcolligan/server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dcolligan/server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dcolligan/server/teams","hooks_url":"https://api.github.com/repos/dcolligan/server/hooks","issue_events_url":"https://api.github.com/repos/dcolligan/server/issues/events{/number}","events_url":"https://api.github.com/repos/dcolligan/server/events","assignees_url":"https://api.github.com/repos/dcolligan/server/assignees{/user}","branches_url":"https://api.github.com/repos/dcolligan/server/branches{/branch}","tags_url":"https://api.github.com/repos/dcolligan/server/tags","blobs_url":"https://api.github.com/repos/dcolligan/server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dcolligan/server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dcolligan/server/git/refs{/sha}","trees_url":"https://api.github.com/repos/dcolligan/server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dcolligan/server/statuses/{sha}","languages_url":"https://api.github.com/repos/dcolligan/server/languages","stargazers_url":"https://api.github.com/repos/dcolligan/server/stargazers","contributors_url":"https://api.github.com/repos/dcolligan/server/contributors","subscribers_url":"https://api.github.com/repos/dcolligan/server/subscribers","subscription_url":"https://api.github.com/repos/dcolligan/server/subscription","commits_url":"https://api.github.com/repos/dcolligan/server/commits{/sha}","git_commits_url":"https://api.github.com/repos/dcolligan/server/git/commits{/sha}","comments_url":"https://api.github.com/repos/dcolligan/server/comments{/number}","issue_comment_url":"https://api.github.com/repos/dcolligan/server/issues/comments{/number}","contents_url":"https://api.github.com/repos/dcolligan/server/contents/{+path}","compare_url":"https://api.github.com/repos/dcolligan/server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dcolligan/server/merges","archive_url":"https://api.github.com/repos/dcolligan/server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dcolligan/server/downloads","issues_url":"https://api.github.com/repos/dcolligan/server/issues{/number}","pulls_url":"https://api.github.com/repos/dcolligan/server/pulls{/number}","milestones_url":"https://api.github.com/repos/dcolligan/server/milestones{/number}","notifications_url":"https://api.github.com/repos/dcolligan/server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dcolligan/server/labels{/name}","releases_url":"https://api.github.com/repos/dcolligan/server/releases{/id}","deployments_url":"https://api.github.com/repos/dcolligan/server/deployments","created_at":"2015-01-14T20:53:47Z","updated_at":"2016-01-15T19:56:57Z","pushed_at":"2016-07-12T15:39:06Z","git_url":"git://github.com/dcolligan/server.git","ssh_url":"git@github.com:dcolligan/server.git","clone_url":"https://github.com/dcolligan/server.git","svn_url":"https://github.com/dcolligan/server","homepage":null,"size":4915,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"ga4gh:master","ref":"master","sha":"fb1c738f2cc5bf2b80a36aff01d036fd6dcad562","user":{"login":"ga4gh","id":6921777,"avatar_url":"https://avatars.githubusercontent.com/u/6921777?v=3","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"repo":{"id":22882621,"name":"server","full_name":"ga4gh/server","owner":{"login":"ga4gh","id":6921777,"avatar_url":"https://avatars.githubusercontent.com/u/6921777?v=3","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ga4gh/server","description":"A reference implementation of the APIs defined in the schemas repository.","fork":false,"url":"https://api.github.com/repos/ga4gh/server","forks_url":"https://api.github.com/repos/ga4gh/server/forks","keys_url":"https://api.github.com/repos/ga4gh/server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ga4gh/server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ga4gh/server/teams","hooks_url":"https://api.github.com/repos/ga4gh/server/hooks","issue_events_url":"https://api.github.com/repos/ga4gh/server/issues/events{/number}","events_url":"https://api.github.com/repos/ga4gh/server/events","assignees_url":"https://api.github.com/repos/ga4gh/server/assignees{/user}","branches_url":"https://api.github.com/repos/ga4gh/server/branches{/branch}","tags_url":"https://api.github.com/repos/ga4gh/server/tags","blobs_url":"https://api.github.com/repos/ga4gh/server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ga4gh/server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ga4gh/server/git/refs{/sha}","trees_url":"https://api.github.com/repos/ga4gh/server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ga4gh/server/statuses/{sha}","languages_url":"https://api.github.com/repos/ga4gh/server/languages","stargazers_url":"https://api.github.com/repos/ga4gh/server/stargazers","contributors_url":"https://api.github.com/repos/ga4gh/server/contributors","subscribers_url":"https://api.github.com/repos/ga4gh/server/subscribers","subscription_url":"https://api.github.com/repos/ga4gh/server/subscription","commits_url":"https://api.github.com/repos/ga4gh/server/commits{/sha}","git_commits_url":"https://api.github.com/repos/ga4gh/server/git/commits{/sha}","comments_url":"https://api.github.com/repos/ga4gh/server/comments{/number}","issue_comment_url":"https://api.github.com/repos/ga4gh/server/issues/comments{/number}","contents_url":"https://api.github.com/repos/ga4gh/server/contents/{+path}","compare_url":"https://api.github.com/repos/ga4gh/server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ga4gh/server/merges","archive_url":"https://api.github.com/repos/ga4gh/server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ga4gh/server/downloads","issues_url":"https://api.github.com/repos/ga4gh/server/issues{/number}","pulls_url":"https://api.github.com/repos/ga4gh/server/pulls{/number}","milestones_url":"https://api.github.com/repos/ga4gh/server/milestones{/number}","notifications_url":"https://api.github.com/repos/ga4gh/server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ga4gh/server/labels{/name}","releases_url":"https://api.github.com/repos/ga4gh/server/releases{/id}","deployments_url":"https://api.github.com/repos/ga4gh/server/deployments","created_at":"2014-08-12T15:31:49Z","updated_at":"2016-07-02T02:00:04Z","pushed_at":"2016-07-13T08:02:25Z","git_url":"git://github.com/ga4gh/server.git","ssh_url":"git@github.com:ga4gh/server.git","clone_url":"https://github.com/ga4gh/server.git","svn_url":"https://github.com/ga4gh/server","homepage":null,"size":10902,"stargazers_count":66,"watchers_count":66,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":87,"mirror_url":null,"open_issues_count":147,"forks":87,"open_issues":147,"watchers":66,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ga4gh/server/pulls/1219"},"html":{"href":"https://github.com/ga4gh/server/pull/1219"},"issue":{"href":"https://api.github.com/repos/ga4gh/server/issues/1219"},"comments":{"href":"https://api.github.com/repos/ga4gh/server/issues/1219/comments"},"review_comments":{"href":"https://api.github.com/repos/ga4gh/server/pulls/1219/comments"},"review_comment":{"href":"https://api.github.com/repos/ga4gh/server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ga4gh/server/pulls/1219/commits"},"statuses":{"href":"https://api.github.com/repos/ga4gh/server/statuses/9763b1a9e316a673f3e0f9ebc9de25f1ff2340cc"}}}}
{"actor":{"display_login":"jeromekelleher"}}