{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/comments/153848353","pull_request_review_id":79910836,"id":153848353,"diff_hunk":"@@ -212,6 +218,95 @@ class Foo(Exception):\n         self.assertIsNone(xact.id)\n         self.assertEqual(ds_api.begin_transaction.call_count, 1)\n \n+    def test_default(self):\n+        project = 'PROJECT'\n+        id_ = 850302\n+        ds_api = _make_datastore_api(xact=id_)\n+        client = _Client(project, datastore_api=ds_api)\n+        xact = self._make_one(client)\n+        self.assertTrue(isinstance(xact.options, self._get_options_class()))\n+\n+    def test_read_only(self):\n+        project = 'PROJECT'\n+        id_ = 850302\n+        ds_api = _make_datastore_api(xact=id_)\n+        client = _Client(project, datastore_api=ds_api)\n+        read_only = self._get_options_class().ReadOnly()\n+        options = self._make_options(read_only=read_only)\n+        xact = self._make_one(client, read_only=True)\n+        xact.begin()\n+        begin = ds_api.begin_transaction\n+        begin.assert_called_once()\n+        self.assertEqual(begin.call_count, 1)\n+\n+    def test_read_write(self):\n+        project = 'PROJECT'\n+        id_ = 850304\n+        ds_api = _make_datastore_api(xact_id=id_)\n+        client = _Client(project, datastore_api=ds_api)\n+        options = self._make_options(read_write=\n+                                     self._get_options_class().ReadWrite())\n+        xact = self._make_one(client)\n+        xact.begin()\n+        begin = ds_api.begin_transaction\n+        begin.assert_called_once()\n+        self.assertEqual(begin.call_count, 1)\n+\n+    def test_previous_tid(self):\n+        project = 'PROJECT'\n+        id_ = 943243\n+        ds_api = _make_datastore_api(xact_id=id_)\n+        client = _Client(project, datastore_api=ds_api)\n+        options_klass = self._get_options_class()\n+        read_write = options_klass.ReadWrite(previous_transaction=b'321')\n+        options = self._make_options(read_write=read_write)\n+        xact = self._make_one(client)\n+        xact.begin()\n+        begin = ds_api.begin_transaction\n+        begin.assert_called_once()\n+        self.assertEqual(begin.call_count, 1)\n+\n+    def test_put_read_only(self):\n+        project = 'PROJECT'\n+        id_ = 943243\n+        ds_api = _make_datastore_api(xact_id=id_)\n+        client = _Client(project, datastore_api=ds_api)\n+        options_klass = self._get_options_class()\n+        options = self._make_options(read_only=options_klass.ReadOnly())\n+        entity = _Entity()\n+        xact = self._make_one(client, read_only=True)\n+        xact.begin()\n+        with self.assertRaises(RuntimeError):\n+            xact.put(entity)\n+\n+    def test_put_read_write(self):\n+        project = 'PROJECT'\n+        id_ = 943243\n+        ds_api = _make_datastore_api(xact_id=id_)\n+        client = _Client(project, datastore_api=ds_api)\n+        options_klass = self._get_options_class()\n+        read_write = options_klass.ReadWrite(previous_transaction=b'321')\n+        options = self._make_options(read_write=read_write)\n+        entity = _Entity()\n+        xact = self._make_one(client)\n+        xact.begin()\n+        xact.put(entity)\n+        mutated_entity = _mutated_pb(self, xact.mutations, 'insert')\n+        self.assertEqual(mutated_entity.key, entity.key.to_protobuf())\n+\n+\n+def _mutated_pb(test_case, mutation_pb_list, mutation_type):","path":"datastore/tests/unit/test_transaction.py","position":101,"original_position":101,"commit_id":"c92036a59968a492744eebe924229fcfdac3cde4","original_commit_id":"c92036a59968a492744eebe924229fcfdac3cde4","user":{"login":"dhermes","id":520669,"avatar_url":"https://avatars3.githubusercontent.com/u/520669?v=4","gravatar_id":"","url":"https://api.github.com/users/dhermes","html_url":"https://github.com/dhermes","followers_url":"https://api.github.com/users/dhermes/followers","following_url":"https://api.github.com/users/dhermes/following{/other_user}","gists_url":"https://api.github.com/users/dhermes/gists{/gist_id}","starred_url":"https://api.github.com/users/dhermes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhermes/subscriptions","organizations_url":"https://api.github.com/users/dhermes/orgs","repos_url":"https://api.github.com/users/dhermes/repos","events_url":"https://api.github.com/users/dhermes/events{/privacy}","received_events_url":"https://api.github.com/users/dhermes/received_events","type":"User","site_admin":false},"body":"Please remove this helper (only used by `test_put_read_write`, which should be removed)","created_at":"2017-11-29T16:52:57Z","updated_at":"2017-11-29T16:53:34Z","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/4357#discussion_r153848353","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/4357","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/comments/153848353"},"html":{"href":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/4357#discussion_r153848353"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/4357"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/4357","id":151304796,"html_url":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/4357","diff_url":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/4357.diff","patch_url":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/4357.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/4357","number":4357,"state":"open","locked":false,"title":"Datastore: Add support for 'TransactionOptions'","user":{"login":"chemelnucfin","id":3982092,"avatar_url":"https://avatars1.githubusercontent.com/u/3982092?v=4","gravatar_id":"","url":"https://api.github.com/users/chemelnucfin","html_url":"https://github.com/chemelnucfin","followers_url":"https://api.github.com/users/chemelnucfin/followers","following_url":"https://api.github.com/users/chemelnucfin/following{/other_user}","gists_url":"https://api.github.com/users/chemelnucfin/gists{/gist_id}","starred_url":"https://api.github.com/users/chemelnucfin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chemelnucfin/subscriptions","organizations_url":"https://api.github.com/users/chemelnucfin/orgs","repos_url":"https://api.github.com/users/chemelnucfin/repos","events_url":"https://api.github.com/users/chemelnucfin/events{/privacy}","received_events_url":"https://api.github.com/users/chemelnucfin/received_events","type":"User","site_admin":false},"body":"Changes reflecting review and Luke's autogen (please see #4348 for issues regarding his autogen).  A manual fix has been included.\r\n\r\nCloses #4335.  This includes reviews and changes from there.","created_at":"2017-11-08T06:45:30Z","updated_at":"2017-11-29T16:53:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c59310673af514699dc2f2675ad818b6b2706832","assignee":null,"assignees":[],"requested_reviewers":[{"login":"lukesneeringer","id":4346,"avatar_url":"https://avatars0.githubusercontent.com/u/4346?v=4","gravatar_id":"","url":"https://api.github.com/users/lukesneeringer","html_url":"https://github.com/lukesneeringer","followers_url":"https://api.github.com/users/lukesneeringer/followers","following_url":"https://api.github.com/users/lukesneeringer/following{/other_user}","gists_url":"https://api.github.com/users/lukesneeringer/gists{/gist_id}","starred_url":"https://api.github.com/users/lukesneeringer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukesneeringer/subscriptions","organizations_url":"https://api.github.com/users/lukesneeringer/orgs","repos_url":"https://api.github.com/users/lukesneeringer/repos","events_url":"https://api.github.com/users/lukesneeringer/events{/privacy}","received_events_url":"https://api.github.com/users/lukesneeringer/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/4357/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/4357/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/4357/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/statuses/c92036a59968a492744eebe924229fcfdac3cde4","head":{"label":"chemelnucfin:issue4278-transactionoption2","ref":"issue4278-transactionoption2","sha":"c92036a59968a492744eebe924229fcfdac3cde4","user":{"login":"chemelnucfin","id":3982092,"avatar_url":"https://avatars1.githubusercontent.com/u/3982092?v=4","gravatar_id":"","url":"https://api.github.com/users/chemelnucfin","html_url":"https://github.com/chemelnucfin","followers_url":"https://api.github.com/users/chemelnucfin/followers","following_url":"https://api.github.com/users/chemelnucfin/following{/other_user}","gists_url":"https://api.github.com/users/chemelnucfin/gists{/gist_id}","starred_url":"https://api.github.com/users/chemelnucfin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chemelnucfin/subscriptions","organizations_url":"https://api.github.com/users/chemelnucfin/orgs","repos_url":"https://api.github.com/users/chemelnucfin/repos","events_url":"https://api.github.com/users/chemelnucfin/events{/privacy}","received_events_url":"https://api.github.com/users/chemelnucfin/received_events","type":"User","site_admin":false},"repo":{"id":108302466,"name":"google-cloud-python","full_name":"chemelnucfin/google-cloud-python","owner":{"login":"chemelnucfin","id":3982092,"avatar_url":"https://avatars1.githubusercontent.com/u/3982092?v=4","gravatar_id":"","url":"https://api.github.com/users/chemelnucfin","html_url":"https://github.com/chemelnucfin","followers_url":"https://api.github.com/users/chemelnucfin/followers","following_url":"https://api.github.com/users/chemelnucfin/following{/other_user}","gists_url":"https://api.github.com/users/chemelnucfin/gists{/gist_id}","starred_url":"https://api.github.com/users/chemelnucfin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chemelnucfin/subscriptions","organizations_url":"https://api.github.com/users/chemelnucfin/orgs","repos_url":"https://api.github.com/users/chemelnucfin/repos","events_url":"https://api.github.com/users/chemelnucfin/events{/privacy}","received_events_url":"https://api.github.com/users/chemelnucfin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chemelnucfin/google-cloud-python","description":"Google Cloud Client Library for Python","fork":true,"url":"https://api.github.com/repos/chemelnucfin/google-cloud-python","forks_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/forks","keys_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/teams","hooks_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/hooks","issue_events_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/issues/events{/number}","events_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/events","assignees_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/assignees{/user}","branches_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/branches{/branch}","tags_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/tags","blobs_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/statuses/{sha}","languages_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/languages","stargazers_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/stargazers","contributors_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/contributors","subscribers_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/subscribers","subscription_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/subscription","commits_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/contents/{+path}","compare_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/merges","archive_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/downloads","issues_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/issues{/number}","pulls_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/pulls{/number}","milestones_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/milestones{/number}","notifications_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/labels{/name}","releases_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/releases{/id}","deployments_url":"https://api.github.com/repos/chemelnucfin/google-cloud-python/deployments","created_at":"2017-10-25T17:26:46Z","updated_at":"2017-10-25T17:26:50Z","pushed_at":"2017-11-29T07:31:38Z","git_url":"git://github.com/chemelnucfin/google-cloud-python.git","ssh_url":"git@github.com:chemelnucfin/google-cloud-python.git","clone_url":"https://github.com/chemelnucfin/google-cloud-python.git","svn_url":"https://github.com/chemelnucfin/google-cloud-python","homepage":"https://googlecloudplatform.github.io/google-cloud-python/","size":132070,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"6120936a5e98541f6bfe3a1a6a1d00054c088487","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars0.githubusercontent.com/u/2810941?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":16316451,"name":"google-cloud-python","full_name":"GoogleCloudPlatform/google-cloud-python","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars0.githubusercontent.com/u/2810941?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/google-cloud-python","description":"Google Cloud Client Library for Python","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/deployments","created_at":"2014-01-28T15:51:47Z","updated_at":"2017-11-29T14:00:51Z","pushed_at":"2017-11-29T16:44:38Z","git_url":"git://github.com/GoogleCloudPlatform/google-cloud-python.git","ssh_url":"git@github.com:GoogleCloudPlatform/google-cloud-python.git","clone_url":"https://github.com/GoogleCloudPlatform/google-cloud-python.git","svn_url":"https://github.com/GoogleCloudPlatform/google-cloud-python","homepage":"https://googlecloudplatform.github.io/google-cloud-python/","size":138122,"stargazers_count":1073,"watchers_count":1073,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":498,"mirror_url":null,"archived":false,"open_issues_count":142,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":498,"open_issues":142,"watchers":1073,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/4357"},"html":{"href":"https://github.com/GoogleCloudPlatform/google-cloud-python/pull/4357"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/4357"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/issues/4357/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/4357/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/4357/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/statuses/c92036a59968a492744eebe924229fcfdac3cde4"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"dhermes"}}