{"action":"created","comment":{"url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/comments/44715385","id":44715385,"diff_hunk":"@@ -127,34 +142,52 @@ def test_create_replication_errors(self):\n             )\n \n     def test_list_replications(self):\n-        with mock.patch('cloudant.database.CloudantDatabase.all_docs') as mock_all_docs:\n+        \"\"\" test retrieve replications\"\"\"\n+        def getitem(name):\n+            db_dict = {'_replicator': CouchDatabase(\n+                mock_account,\n+                '_replicator'\n+            )}\n+            return db_dict[name]\n+        with mock.patch('cloudant.database.CouchDatabase.all_docs') as mock_all_docs:\n             mock_all_docs.return_value = {\n                 \"rows\": [\n-                    {\"doc\":\"replication_1\"},\n-                    {\"doc\": \"replication_2\"}\n+                    {\"id\": \"replication_1\", \"doc\": {\"_id\": \"replication_1\"}},\n+                    {\"id\": \"replication_2\", \"doc\": {\"_id\": \"replication_2\"}}\n                 ]\n             }\n             mock_account = mock.Mock()\n-            repl = ReplicatorDatabase(mock_account)\n+            mock_account.__getitem__ = mock.Mock()\n+            mock_account.__getitem__.side_effect = getitem\n+            repl = Replicator(mock_account)\n \n             self.assertEqual(\n                 repl.list_replications(),\n-                ['replication_1', 'replication_2']\n+                [{\"_id\": \"replication_1\"}, {\"_id\": \"replication_2\"}]\n             )\n+\n     def test_replication_state(self):\n         \"\"\"test replication state method\"\"\"\n+        def getitem(name):","path":"tests/unit/mocked/replicator_test.py","position":110,"original_position":110,"commit_id":"550cf726800d211bec51927c26609e7452d6b1e8","original_commit_id":"550cf726800d211bec51927c26609e7452d6b1e8","user":{"login":"emlaver","id":10552966,"avatar_url":"https://avatars.githubusercontent.com/u/10552966?v=3","gravatar_id":"","url":"https://api.github.com/users/emlaver","html_url":"https://github.com/emlaver","followers_url":"https://api.github.com/users/emlaver/followers","following_url":"https://api.github.com/users/emlaver/following{/other_user}","gists_url":"https://api.github.com/users/emlaver/gists{/gist_id}","starred_url":"https://api.github.com/users/emlaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emlaver/subscriptions","organizations_url":"https://api.github.com/users/emlaver/orgs","repos_url":"https://api.github.com/users/emlaver/repos","events_url":"https://api.github.com/users/emlaver/events{/privacy}","received_events_url":"https://api.github.com/users/emlaver/received_events","type":"User","site_admin":false},"body":"`getitem` is defined in several functions.  Would it be possible to create one instance of it that can be shared?","created_at":"2015-11-12T21:13:25Z","updated_at":"2015-11-12T21:13:25Z","html_url":"https://github.com/cloudant/python-cloudant/pull/29#discussion_r44715385","pull_request_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/29","_links":{"self":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/comments/44715385"},"html":{"href":"https://github.com/cloudant/python-cloudant/pull/29#discussion_r44715385"},"pull_request":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/29"}}},"pull_request":{"url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/29","id":50548448,"html_url":"https://github.com/cloudant/python-cloudant/pull/29","diff_url":"https://github.com/cloudant/python-cloudant/pull/29.diff","patch_url":"https://github.com/cloudant/python-cloudant/pull/29.patch","issue_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/29","number":29,"state":"open","locked":false,"title":"Refactor the replicator and add tests","user":{"login":"alfinkel","id":8793303,"avatar_url":"https://avatars.githubusercontent.com/u/8793303?v=3","gravatar_id":"","url":"https://api.github.com/users/alfinkel","html_url":"https://github.com/alfinkel","followers_url":"https://api.github.com/users/alfinkel/followers","following_url":"https://api.github.com/users/alfinkel/following{/other_user}","gists_url":"https://api.github.com/users/alfinkel/gists{/gist_id}","starred_url":"https://api.github.com/users/alfinkel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alfinkel/subscriptions","organizations_url":"https://api.github.com/users/alfinkel/orgs","repos_url":"https://api.github.com/users/alfinkel/repos","events_url":"https://api.github.com/users/alfinkel/events{/privacy}","received_events_url":"https://api.github.com/users/alfinkel/received_events","type":"User","site_admin":false},"body":"_What:_\r\n\r\n- Refactor ReplicatorDatabase to Replicator.\r\n- Add Replicator unit tests that target a Cloudant or CouchDB instance.\r\n\r\n_Why:_\r\n\r\nThe new Replicator class has the database as an attribute so the Replicator provides an API that works with both a CloudantDatabase and a CouchDatabase _replicator database.\r\n\r\n_How:_\r\n\r\n- Based on the account client provided when constructing a Replicator object, the Replicator provides a user friendly API for replication tasks for either a Cloudant or a CouchDB account.\r\n- The list_replications method now returns a list of Document wrapped objects.\r\n- Update the integration/replicator_test.py module based on refactoring.\r\n- Update the mocked/replicator_test.py module based on refactoring.\r\n- Add Replicator tests that target a database instance.\r\n\r\nreviewer: @emlaver\r\n\r\nBugId: 55839","created_at":"2015-11-12T18:28:41Z","updated_at":"2015-11-12T21:13:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a29cf61b16cda993a9f4f21d844070cea83365fa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/29/commits","review_comments_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/29/comments","review_comment_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/29/comments","statuses_url":"https://api.github.com/repos/cloudant/python-cloudant/statuses/550cf726800d211bec51927c26609e7452d6b1e8","head":{"label":"cloudant:55839-add-replicator-tests-and-fixes","ref":"55839-add-replicator-tests-and-fixes","sha":"550cf726800d211bec51927c26609e7452d6b1e8","user":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"repo":{"id":41557383,"name":"python-cloudant","full_name":"cloudant/python-cloudant","owner":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant/python-cloudant","description":"A Python library for Cloudant and CouchDB","fork":false,"url":"https://api.github.com/repos/cloudant/python-cloudant","forks_url":"https://api.github.com/repos/cloudant/python-cloudant/forks","keys_url":"https://api.github.com/repos/cloudant/python-cloudant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant/python-cloudant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant/python-cloudant/teams","hooks_url":"https://api.github.com/repos/cloudant/python-cloudant/hooks","issue_events_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant/python-cloudant/events","assignees_url":"https://api.github.com/repos/cloudant/python-cloudant/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant/python-cloudant/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant/python-cloudant/tags","blobs_url":"https://api.github.com/repos/cloudant/python-cloudant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant/python-cloudant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant/python-cloudant/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant/python-cloudant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant/python-cloudant/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant/python-cloudant/languages","stargazers_url":"https://api.github.com/repos/cloudant/python-cloudant/stargazers","contributors_url":"https://api.github.com/repos/cloudant/python-cloudant/contributors","subscribers_url":"https://api.github.com/repos/cloudant/python-cloudant/subscribers","subscription_url":"https://api.github.com/repos/cloudant/python-cloudant/subscription","commits_url":"https://api.github.com/repos/cloudant/python-cloudant/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant/python-cloudant/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant/python-cloudant/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant/python-cloudant/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant/python-cloudant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant/python-cloudant/merges","archive_url":"https://api.github.com/repos/cloudant/python-cloudant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant/python-cloudant/downloads","issues_url":"https://api.github.com/repos/cloudant/python-cloudant/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant/python-cloudant/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant/python-cloudant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant/python-cloudant/labels{/name}","releases_url":"https://api.github.com/repos/cloudant/python-cloudant/releases{/id}","created_at":"2015-08-28T16:22:49Z","updated_at":"2015-10-25T20:04:50Z","pushed_at":"2015-11-12T18:28:41Z","git_url":"git://github.com/cloudant/python-cloudant.git","ssh_url":"git@github.com:cloudant/python-cloudant.git","clone_url":"https://github.com/cloudant/python-cloudant.git","svn_url":"https://github.com/cloudant/python-cloudant","homepage":null,"size":763,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":4,"default_branch":"master"}},"base":{"label":"cloudant:master","ref":"master","sha":"e03155f94ed363a5b0cdb62933c6f4dce1fc2433","user":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"repo":{"id":41557383,"name":"python-cloudant","full_name":"cloudant/python-cloudant","owner":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant/python-cloudant","description":"A Python library for Cloudant and CouchDB","fork":false,"url":"https://api.github.com/repos/cloudant/python-cloudant","forks_url":"https://api.github.com/repos/cloudant/python-cloudant/forks","keys_url":"https://api.github.com/repos/cloudant/python-cloudant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant/python-cloudant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant/python-cloudant/teams","hooks_url":"https://api.github.com/repos/cloudant/python-cloudant/hooks","issue_events_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant/python-cloudant/events","assignees_url":"https://api.github.com/repos/cloudant/python-cloudant/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant/python-cloudant/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant/python-cloudant/tags","blobs_url":"https://api.github.com/repos/cloudant/python-cloudant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant/python-cloudant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant/python-cloudant/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant/python-cloudant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant/python-cloudant/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant/python-cloudant/languages","stargazers_url":"https://api.github.com/repos/cloudant/python-cloudant/stargazers","contributors_url":"https://api.github.com/repos/cloudant/python-cloudant/contributors","subscribers_url":"https://api.github.com/repos/cloudant/python-cloudant/subscribers","subscription_url":"https://api.github.com/repos/cloudant/python-cloudant/subscription","commits_url":"https://api.github.com/repos/cloudant/python-cloudant/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant/python-cloudant/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant/python-cloudant/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant/python-cloudant/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant/python-cloudant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant/python-cloudant/merges","archive_url":"https://api.github.com/repos/cloudant/python-cloudant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant/python-cloudant/downloads","issues_url":"https://api.github.com/repos/cloudant/python-cloudant/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant/python-cloudant/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant/python-cloudant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant/python-cloudant/labels{/name}","releases_url":"https://api.github.com/repos/cloudant/python-cloudant/releases{/id}","created_at":"2015-08-28T16:22:49Z","updated_at":"2015-10-25T20:04:50Z","pushed_at":"2015-11-12T18:28:41Z","git_url":"git://github.com/cloudant/python-cloudant.git","ssh_url":"git@github.com:cloudant/python-cloudant.git","clone_url":"https://github.com/cloudant/python-cloudant.git","svn_url":"https://github.com/cloudant/python-cloudant","homepage":null,"size":763,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/29"},"html":{"href":"https://github.com/cloudant/python-cloudant/pull/29"},"issue":{"href":"https://api.github.com/repos/cloudant/python-cloudant/issues/29"},"comments":{"href":"https://api.github.com/repos/cloudant/python-cloudant/issues/29/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/29/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/29/commits"},"statuses":{"href":"https://api.github.com/repos/cloudant/python-cloudant/statuses/550cf726800d211bec51927c26609e7452d6b1e8"}}}}