Skip to content

Commit

Permalink
bigquery: add system test for dataset update with etag (#4052)
Browse files Browse the repository at this point in the history
  • Loading branch information
jba authored Sep 25, 2017
1 parent 08141bd commit 20e3d7b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bigquery/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import six

from google.api.core.exceptions import PreconditionFailed
from google.cloud import bigquery
from google.cloud.bigquery.dataset import Dataset, DatasetReference
from google.cloud.bigquery.table import Table
Expand Down Expand Up @@ -158,7 +159,11 @@ def test_update_dataset(self):
ds3 = Config.CLIENT.update_dataset(ds2, ['labels'])
self.assertEqual(ds3.labels, {'color': 'green', 'shape': 'circle'})

# TODO(jba): test that read-modify-write with ETag works.
# If we try to update using d2 again, it will fail because the
# previous update changed the ETag.
ds2.description = 'no good'
with self.assertRaises(PreconditionFailed):
Config.CLIENT.update_dataset(ds2, ['description'])

def test_list_datasets(self):
datasets_to_create = [
Expand Down

0 comments on commit 20e3d7b

Please sign in to comment.