Repository: laughingman7743/BigQuery-DatasetManager

Issue:
Migrating to Python Client Library v0.28
https://github.com/GoogleCloudPlatform/google-cloud-python/releases/tag/bigquery-0.28.0

Discussion:

Patch:
diff --git a/README.rst b/README.rst
index 3559c85..a4799df 100644
--- a/README.rst
+++ b/README.rst
@@ -44,7 +44,7 @@ The resource representation of the dataset is described in `YAML format`_.
     description: null
     default_table_expiration_ms: null
     location: US
-    access_grants:
+    access_entries:
     -   role: OWNER
         entity_type: specialGroup
         entity_id: projectOwners
@@ -62,48 +62,48 @@ The resource representation of the dataset is described in `YAML format`_.
 
 See `the official documentation of BigQuery Datasets`_ for details of key names.
 
-+---------------+-------------+-----------+---------+----------------------------------------------------------+
-| Key name                                | Value   | Description                                              |
-+===============+=============+===========+=========+==========================================================+
-| name                                    | str     | The name of the dataset.                                 |
-+---------------+-------------+-----------+---------+----------------------------------------------------------+
-| friendly_name                           | str     | Title of the dataset.                                    |
-+---------------+-------------+-----------+---------+----------------------------------------------------------+
-| description                             | str     | Description of the dataset.                              |
-+---------------+-------------+-----------+---------+----------------------------------------------------------+
-| default_table_expiration_ms             | int     | Default expiration time for tables in the dataset.       |
-+---------------+-------------+-----------+---------+----------------------------------------------------------+
-| location                                | str     | Location in which the dataset is hosted.                 |
-+---------------+-------------+-----------+---------+----------------------------------------------------------+
-| access_grants                           | seq     | Roles granted to entities for this dataset.              |
-+---------------+-------------+-----------+---------+----------------------------------------------------------+
-| access_grants | role                    | str     | Role granted to the entity. One of                       |
-|               |                         |         |                                                          |
-|               |                         |         | * ``OWNER``                                              |
-|               |                         |         | * ``WRITER``                                             |
-|               |                         |         | * ``READER``                                             |
-|               |                         |         |                                                          |
-|               |                         |         | May also be ``None`` if the ``entity_type`` is ``view``. |
-+               +-------------+-----------+---------+----------------------------------------------------------+
-|               | entity_type             | str     | Type of entity being granted the role. One of            |
-|               |                         |         |                                                          |
-|               |                         |         | * ``userByEmail``                                        |
-|               |                         |         | * ``groupByEmail``                                       |
-|               |                         |         | * ``domain``                                             |
-|               |                         |         | * ``specialGroup``                                       |
-|               |                         |         | * ``view``                                               |
-+               +-------------+-----------+---------+----------------------------------------------------------+
-|               | entity_id   |           | str/map | ID of entity being granted the role.                     |
-+               +             +-----------+---------+----------------------------------------------------------+
-|               |             | datasetId | str     | The ID of the dataset containing this table.             |
-|               |             |           |         | (Specified when ``entity_type`` is ``view``.)            |
-+               +             +-----------+---------+----------------------------------------------------------+
-|               |             | projectId | str     | The ID of the project containing this table.             |
-|               |             |           |         | (Specified when ``entity_type`` is ``view``.)            |
-+               +             +-----------+---------+----------------------------------------------------------+
-|               |             | tableId   | str     | The ID of the table.                                     |
-|               |             |           |         | (Specified when ``entity_type`` is ``view``.)            |
-+---------------+-------------+-----------+---------+----------------------------------------------------------+
++----------------+-------------+-----------+---------+----------------------------------------------------------+
+| Key name                                 | Value   | Description                                              |
++================+=============+===========+=========+==========================================================+
+| name                                     | str     | The name of the dataset.                                 |
++----------------+-------------+-----------+---------+----------------------------------------------------------+
+| friendly_name                            | str     | Title of the dataset.                                    |
++----------------+-------------+-----------+---------+----------------------------------------------------------+
+| description                              | str     | Description of the dataset.                              |
++----------------+-------------+-----------+---------+----------------------------------------------------------+
+| default_table_expiration_ms              | int     | Default expiration time for tables in the dataset.       |
++----------------+-------------+-----------+---------+----------------------------------------------------------+
+| location                                 | str     | Location in which the dataset is hosted.                 |
++----------------+-------------+-----------+---------+----------------------------------------------------------+
+| access_entries                           | seq     | Represent grant of an access role to an entity.          |
++----------------+-------------+-----------+---------+----------------------------------------------------------+
+| access_entries | role                    | str     | Role granted to the entity. One of                       |
+|                |                         |         |                                                          |
+|                |                         |         | * ``OWNER``                                              |
+|                |                         |         | * ``WRITER``                                             |
+|                |                         |         | * ``READER``                                             |
+|                |                         |         |                                                          |
+|                |                         |         | May also be ``None`` if the ``entity_type`` is ``view``. |
++                +-------------+-----------+---------+----------------------------------------------------------+
+|                | entity_type             | str     | Type of entity being granted the role. One of            |
+|                |                         |         |                                                          |
+|                |                         |         | * ``userByEmail``                                        |
+|                |                         |         | * ``groupByEmail``                                       |
+|                |                         |         | * ``domain``                                             |
+|                |                         |         | * ``specialGroup``                                       |
+|                |                         |         | * ``view``                                               |
++                +-------------+-----------+---------+----------------------------------------------------------+
+|                | entity_id   |           | str/map | ID of entity being granted the role.                     |
++                +             +-----------+---------+----------------------------------------------------------+
+|                |             | datasetId | str     | The ID of the dataset containing this table.             |
+|                |             |           |         | (Specified when ``entity_type`` is ``view``.)            |
++                +             +-----------+---------+----------------------------------------------------------+
+|                |             | projectId | str     | The ID of the project containing this table.             |
+|                |             |           |         | (Specified when ``entity_type`` is ``view``.)            |
++                +             +-----------+---------+----------------------------------------------------------+
+|                |             | tableId   | str     | The ID of the table.                                     |
+|                |             |           |         | (Specified when ``entity_type`` is ``view``.)            |
++----------------+-------------+-----------+---------+----------------------------------------------------------+
 
 .. _`the official documentation of BigQuery Datasets`: https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets
 
diff --git a/bqdm/cli.py b/bqdm/cli.py
index 9f2a945..5405243 100755
--- a/bqdm/cli.py
+++ b/bqdm/cli.py
@@ -12,7 +12,7 @@ from past.types import unicode
 import bqdm.message as msg
 from bqdm import CONTEXT_SETTINGS
 from bqdm.action import DatasetAction
-from bqdm.model import BigQueryDataset, BigQueryAccessGrant
+from bqdm.model import BigQueryDataset, BigQueryAccessEntry
 from bqdm.util import list_local_datasets, ordered_dict_constructor, str_representer
 
 
@@ -24,7 +24,7 @@ _logger.setLevel(logging.INFO)
 yaml.add_representer(str, str_representer)
 yaml.add_representer(unicode, str_representer)
 yaml.add_representer(BigQueryDataset, BigQueryDataset.represent)
-yaml.add_representer(BigQueryAccessGrant, BigQueryAccessGrant.represent)
+yaml.add_representer(BigQueryAccessEntry, BigQueryAccessEntry.represent)
 yaml.add_constructor('tag:yaml.org,2002:map', ordered_dict_constructor)
 
 
diff --git a/bqdm/model.py b/bqdm/model.py
index c835def..c93266d 100644
--- a/bqdm/model.py
+++ b/bqdm/model.py
@@ -3,51 +3,51 @@ from __future__ import absolute_import
 from collections import OrderedDict
 
 from future.utils import iteritems
-from google.cloud.bigquery.dataset import Dataset, AccessGrant
+from google.cloud.bigquery.dataset import Dataset, AccessEntry
 
 
 class BigQueryDataset(object):
 
     def __init__(self, name, friendly_name, description,
-                 default_table_expiration_ms, location, access_grants):
+                 default_table_expiration_ms, location, access_entries):
         self.name = name
         self.friendly_name = friendly_name
         self.description = description
         self.default_table_expiration_ms = default_table_expiration_ms
         self.location = location
-        self.access_grants = access_grants
+        self.access_entries = access_entries
 
     @staticmethod
     def from_dict(value):
-        access_grants = value.get('access_grants', None)
-        if access_grants:
-            access_grants = [BigQueryAccessGrant.from_dict(a) for a in access_grants]
+        access_entries = value.get('access_entries', None)
+        if access_entries:
+            access_entries = [BigQueryAccessEntry.from_dict(a) for a in access_entries]
         return BigQueryDataset(value.get('name', None),
                                value.get('friendly_name', None),
                                value.get('description', None),
                                value.get('default_table_expiration_ms', None),
                                value.get('location', None),
-                               access_grants)
+                               access_entries)
 
     @staticmethod
     def from_dataset(value):
         value.reload()
-        access_grants = value.access_grants
-        if access_grants:
-            access_grants = [BigQueryAccessGrant.from_access_grant(a) for a in access_grants]
+        access_entries = value.access_entries
+        if access_entries:
+            access_entries = [BigQueryAccessEntry.from_access_entry(a) for a in access_entries]
         return BigQueryDataset(value.name,
                                value.friendly_name,
                                value.description,
                                value.default_table_expiration_ms,
                                value.location,
-                               access_grants)
+                               access_entries)
 
     @staticmethod
     def to_dataset(client, value):
-        access_grants = value.access_grants
-        if access_grants:
-            access_grants = tuple([BigQueryAccessGrant.to_access_grant(a) for a in access_grants])
-        dataset = Dataset(value.name, client, access_grants)
+        access_entries = value.access_entries
+        if access_entries:
+            access_entries = tuple([BigQueryAccessEntry.to_access_entry(a) for a in access_entries])
+        dataset = Dataset(value.name, client, access_entries)
         dataset.friendly_name = value.friendly_name
         dataset.description = value.description
         dataset.default_table_expiration_ms = value.default_table_expiration_ms
@@ -64,7 +64,7 @@ class BigQueryDataset(object):
                 ('description', value.description),
                 ('default_table_expiration_ms', value.default_table_expiration_ms),
                 ('location', value.location),
-                ('access_grants', value.access_grants),
+                ('access_entries', value.access_entries),
             )
         )
 
@@ -74,8 +74,8 @@ class BigQueryDataset(object):
                 self.description,
                 self.default_table_expiration_ms,
                 self.location,
-                frozenset(self.access_grants) if self.access_grants is not None
-                else self.access_grants,)
+                frozenset(self.access_entries) if self.access_entries is not None
+                else self.access_entries,)
 
     def __eq__(self, other):
         if not isinstance(other, BigQueryDataset):
@@ -92,7 +92,7 @@ class BigQueryDataset(object):
         return 'BigQueryDataset{0}'.format(self._key())
 
 
-class BigQueryAccessGrant(object):
+class BigQueryAccessEntry(object):
 
     def __init__(self, role, entity_type, entity_id):
         self.role = role
@@ -101,21 +101,21 @@ class BigQueryAccessGrant(object):
 
     @staticmethod
     def from_dict(value):
-        return BigQueryAccessGrant(
+        return BigQueryAccessEntry(
             value.get('role', None),
             value.get('entity_type', None),
             value.get('entity_id', None),)
 
     @staticmethod
-    def from_access_grant(value):
-        return BigQueryAccessGrant(
+    def from_access_entry(value):
+        return BigQueryAccessEntry(
             value.role,
             value.entity_type,
             value.entity_id,)
 
     @staticmethod
-    def to_access_grant(value):
-        return AccessGrant(value.role, value.entity_type, value.entity_id)
+    def to_access_entry(value):
+        return AccessEntry(value.role, value.entity_type, value.entity_id)
 
     @staticmethod
     def represent(dumper, value):
@@ -135,7 +135,7 @@ class BigQueryAccessGrant(object):
                 if isinstance(self.entity_id, (dict, OrderedDict,)) else self.entity_id,)
 
     def __eq__(self, other):
-        if not isinstance(other, BigQueryAccessGrant):
+        if not isinstance(other, BigQueryAccessEntry):
             return NotImplemented
         return self._key() == other._key()
 
@@ -146,4 +146,4 @@ class BigQueryAccessGrant(object):
         return hash(self._key())
 
     def __repr__(self):
-        return 'BigQueryAccessGrant{0}'.format(self._key())
+        return 'BigQueryAccessEntry{0}'.format(self._key())
diff --git a/setup.py b/setup.py
index 6808225..742814f 100755
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,7 @@ setup(
         'future',
         'click>=6.0',
         'PyYAML>=3.12',
-        'google-cloud-bigquery>=0.27.0',
+        'google-cloud-bigquery==0.28.0',
     ],
     tests_require=[
         'pytest',


Test patch:
diff --git a/tests/__init__.py b/tests/__init__.py
index 688a9d5..95bd52a 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -2,10 +2,10 @@
 import yaml
 
 from bqdm.util import ordered_dict_constructor, str_representer
-from bqdm.model import BigQueryDataset, BigQueryAccessGrant
+from bqdm.model import BigQueryDataset, BigQueryAccessEntry
 
 
 yaml.add_representer(str, str_representer)
 yaml.add_representer(BigQueryDataset, BigQueryDataset.represent)
-yaml.add_representer(BigQueryAccessGrant, BigQueryAccessGrant.represent)
+yaml.add_representer(BigQueryAccessEntry, BigQueryAccessEntry.represent)
 yaml.add_constructor('tag:yaml.org,2002:map', ordered_dict_constructor)
diff --git a/tests/test_action.py b/tests/test_action.py
index ad52c1b..16b2cd9 100644
--- a/tests/test_action.py
+++ b/tests/test_action.py
@@ -2,7 +2,7 @@
 import unittest
 
 from bqdm.action import DatasetAction
-from bqdm.model import BigQueryDataset, BigQueryAccessGrant
+from bqdm.model import BigQueryDataset, BigQueryAccessEntry
 
 
 class TestAction(unittest.TestCase):
@@ -75,7 +75,7 @@ class TestAction(unittest.TestCase):
             24 * 30 * 60 * 1000,
             'US',
             [
-                BigQueryAccessGrant(
+                BigQueryAccessEntry(
                     None,
                     'view',
                     {
@@ -149,7 +149,7 @@ class TestAction(unittest.TestCase):
             24 * 30 * 60 * 1000,
             'US',
             [
-                BigQueryAccessGrant(
+                BigQueryAccessEntry(
                     None,
                     'view',
                     {
@@ -223,7 +223,7 @@ class TestAction(unittest.TestCase):
             24 * 30 * 60 * 1000,
             'US',
             [
-                BigQueryAccessGrant(
+                BigQueryAccessEntry(
                     None,
                     'view',
                     {
diff --git a/tests/test_model.py b/tests/test_model.py
index 653d826..032c42b 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 import unittest
 
-from bqdm.model import BigQueryDataset, BigQueryAccessGrant
+from bqdm.model import BigQueryDataset, BigQueryAccessEntry
 
 
 class TestModel(unittest.TestCase):
@@ -44,18 +44,18 @@ class TestModel(unittest.TestCase):
         self.assertNotEqual(dataset1, dataset4)
         self.assertNotEqual(dataset3, dataset4)
 
-    def test_eq_dataset_with_access_grant(self):
-        access_grant1 = BigQueryAccessGrant(
+    def test_eq_dataset_with_access_entry(self):
+        access_entry1 = BigQueryAccessEntry(
             'OWNER',
             'specialGroup',
             'projectOwners'
         )
-        access_grant2 = BigQueryAccessGrant(
+        access_entry2 = BigQueryAccessEntry(
             'OWNER',
             'specialGroup',
             'projectOwners'
         )
-        access_grant3 = BigQueryAccessGrant(
+        access_entry3 = BigQueryAccessEntry(
             None,
             'view',
             {
@@ -65,69 +65,69 @@ class TestModel(unittest.TestCase):
             }
         )
 
-        dataset_with_access_grant1 = BigQueryDataset(
+        dataset_with_access_entry1 = BigQueryDataset(
             'test',
             'test_friendly_name',
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant1]
+            [access_entry1]
         )
-        dataset_with_access_grant2 = BigQueryDataset(
+        dataset_with_access_entry2 = BigQueryDataset(
             'test',
             'test_friendly_name',
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant2]
+            [access_entry2]
         )
-        dataset_with_access_grant3 = BigQueryDataset(
+        dataset_with_access_entry3 = BigQueryDataset(
             'test',
             'test_friendly_name',
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant3]
+            [access_entry3]
         )
-        dataset_with_access_grant4 = BigQueryDataset(
+        dataset_with_access_entry4 = BigQueryDataset(
             'foo',
             'bar',
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant1]
+            [access_entry1]
         )
-        dataset_with_access_grant5 = BigQueryDataset(
+        dataset_with_access_entry5 = BigQueryDataset(
             'foo',
             'bar',
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant1, access_grant3]
+            [access_entry1, access_entry3]
         )
-        dataset_with_access_grant6 = BigQueryDataset(
+        dataset_with_access_entry6 = BigQueryDataset(
             'foo',
             'bar',
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant3, access_grant1]
+            [access_entry3, access_entry1]
         )
-        dataset_with_access_grant7 = BigQueryDataset(
+        dataset_with_access_entry7 = BigQueryDataset(
             'foo',
             'bar',
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant1, access_grant2]
+            [access_entry1, access_entry2]
         )
-        self.assertEqual(dataset_with_access_grant1, dataset_with_access_grant2)
-        self.assertNotEqual(dataset_with_access_grant1, dataset_with_access_grant3)
-        self.assertNotEqual(dataset_with_access_grant1, dataset_with_access_grant4)
-        self.assertNotEqual(dataset_with_access_grant3, dataset_with_access_grant4)
-        self.assertEqual(dataset_with_access_grant5, dataset_with_access_grant6)
-        self.assertEqual(dataset_with_access_grant4, dataset_with_access_grant7)
-        self.assertNotEqual(dataset_with_access_grant6, dataset_with_access_grant7)
+        self.assertEqual(dataset_with_access_entry1, dataset_with_access_entry2)
+        self.assertNotEqual(dataset_with_access_entry1, dataset_with_access_entry3)
+        self.assertNotEqual(dataset_with_access_entry1, dataset_with_access_entry4)
+        self.assertNotEqual(dataset_with_access_entry3, dataset_with_access_entry4)
+        self.assertEqual(dataset_with_access_entry5, dataset_with_access_entry6)
+        self.assertEqual(dataset_with_access_entry4, dataset_with_access_entry7)
+        self.assertNotEqual(dataset_with_access_entry6, dataset_with_access_entry7)
 
     def test_dataset_from_dict(self):
         dataset = BigQueryDataset(
@@ -144,7 +144,7 @@ class TestModel(unittest.TestCase):
             'description': 'test_description',
             'default_table_expiration_ms': 24 * 30 * 60 * 1000,
             'location': 'US',
-            'access_grants': None
+            'access_entris': None
         })
         dataset_from_dict2 = BigQueryDataset.from_dict({
             'name': 'test',
@@ -152,7 +152,7 @@ class TestModel(unittest.TestCase):
             'description': 'test_description',
             'default_table_expiration_ms': None,
             'location': 'US',
-            'access_grants': None
+            'access_entries': None
         })
         dataset_from_dict3 = BigQueryDataset.from_dict({
             'name': 'foo',
@@ -160,19 +160,19 @@ class TestModel(unittest.TestCase):
             'description': 'test_description',
             'default_table_expiration_ms': None,
             'location': 'US',
-            'access_grants': None
+            'access_entries': None
         })
         self.assertEqual(dataset, dataset_from_dict1)
         self.assertNotEqual(dataset, dataset_from_dict2)
         self.assertNotEqual(dataset, dataset_from_dict3)
 
-    def test_dataset_from_dict_with_access_grant(self):
-        access_grant1 = BigQueryAccessGrant(
+    def test_dataset_from_dict_with_access_entry(self):
+        access_entry1 = BigQueryAccessEntry(
             'OWNER',
             'specialGroup',
             'projectOwners'
         )
-        access_grant2 = BigQueryAccessGrant(
+        access_entry2 = BigQueryAccessEntry(
             None,
             'view',
             {
@@ -182,45 +182,45 @@ class TestModel(unittest.TestCase):
             }
         )
 
-        dataset_with_access_grant1 = BigQueryDataset(
+        dataset_with_access_entry1 = BigQueryDataset(
             'test',
             'test_friendly_name',
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant1]
+            [access_entry1]
         )
-        dataset_with_access_grant2 = BigQueryDataset(
+        dataset_with_access_entry2 = BigQueryDataset(
             'test',
             'test_friendly_name',
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant2]
+            [access_entry2]
         )
-        dataset_with_access_grant3 = BigQueryDataset(
+        dataset_with_access_entry3 = BigQueryDataset(
             'test',
             'test_friendly_name',
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant1, access_grant2]
+            [access_entry1, access_entry2]
         )
-        dataset_with_access_grant4 = BigQueryDataset(
+        dataset_with_access_entry4 = BigQueryDataset(
             'test',
             'test_friendly_name',
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant1, access_grant1]
+            [access_entry1, access_entry1]
         )
-        dataset_with_access_grant_from_dict1 = BigQueryDataset.from_dict({
+        dataset_with_access_entry_from_dict1 = BigQueryDataset.from_dict({
             'name': 'test',
             'friendly_name': 'test_friendly_name',
             'description': 'test_description',
             'default_table_expiration_ms': 24 * 30 * 60 * 1000,
             'location': 'US',
-            'access_grants': [
+            'access_entries': [
                 {
                     'role': 'OWNER',
                     'entity_type': 'specialGroup',
@@ -228,13 +228,13 @@ class TestModel(unittest.TestCase):
                 }
             ]
         })
-        dataset_with_access_grant_from_dict2 = BigQueryDataset.from_dict({
+        dataset_with_access_entry_from_dict2 = BigQueryDataset.from_dict({
             'name': 'test',
             'friendly_name': 'test_friendly_name',
             'description': 'test_description',
             'default_table_expiration_ms': 24 * 30 * 60 * 1000,
             'location': 'US',
-            'access_grants': [
+            'access_entries': [
                 {
                     'role': None,
                     'entity_type': 'view',
@@ -246,13 +246,13 @@ class TestModel(unittest.TestCase):
                 }
             ]
         })
-        dataset_with_access_grant_from_dict3 = BigQueryDataset.from_dict({
+        dataset_with_access_entry_from_dict3 = BigQueryDataset.from_dict({
             'name': 'test',
             'friendly_name': 'test_friendly_name',
             'description': 'test_description',
             'default_table_expiration_ms': 24 * 30 * 60 * 1000,
             'location': 'US',
-            'access_grants': [
+            'access_entries': [
                 {
                     'role': 'OWNER',
                     'entity_type': 'specialGroup',
@@ -269,13 +269,13 @@ class TestModel(unittest.TestCase):
                 }
             ]
         })
-        dataset_with_access_grant_from_dict4 = BigQueryDataset.from_dict({
+        dataset_with_access_entry_from_dict4 = BigQueryDataset.from_dict({
             'name': 'test',
             'friendly_name': 'test_friendly_name',
             'description': 'test_description',
             'default_table_expiration_ms': 24 * 30 * 60 * 1000,
             'location': 'US',
-            'access_grants': [
+            'access_entries': [
                 {
                     'role': 'OWNER',
                     'entity_type': 'specialGroup',
@@ -288,15 +288,15 @@ class TestModel(unittest.TestCase):
                 }
             ]
         })
-        self.assertEqual(dataset_with_access_grant1, dataset_with_access_grant_from_dict1)
-        self.assertNotEqual(dataset_with_access_grant1, dataset_with_access_grant_from_dict2)
-        self.assertNotEqual(dataset_with_access_grant1, dataset_with_access_grant_from_dict3)
-        self.assertEqual(dataset_with_access_grant2, dataset_with_access_grant_from_dict2)
-        self.assertNotEqual(dataset_with_access_grant2, dataset_with_access_grant_from_dict1)
-        self.assertNotEqual(dataset_with_access_grant2, dataset_with_access_grant_from_dict3)
-        self.assertEqual(dataset_with_access_grant3, dataset_with_access_grant_from_dict3)
-        self.assertNotEqual(dataset_with_access_grant3, dataset_with_access_grant_from_dict1)
-        self.assertNotEqual(dataset_with_access_grant3, dataset_with_access_grant_from_dict2)
-        self.assertEqual(dataset_with_access_grant4, dataset_with_access_grant_from_dict4)
-        self.assertEqual(dataset_with_access_grant1, dataset_with_access_grant_from_dict4)
-        self.assertEqual(dataset_with_access_grant4, dataset_with_access_grant_from_dict1)
+        self.assertEqual(dataset_with_access_entry1, dataset_with_access_entry_from_dict1)
+        self.assertNotEqual(dataset_with_access_entry1, dataset_with_access_entry_from_dict2)
+        self.assertNotEqual(dataset_with_access_entry1, dataset_with_access_entry_from_dict3)
+        self.assertEqual(dataset_with_access_entry2, dataset_with_access_entry_from_dict2)
+        self.assertNotEqual(dataset_with_access_entry2, dataset_with_access_entry_from_dict1)
+        self.assertNotEqual(dataset_with_access_entry2, dataset_with_access_entry_from_dict3)
+        self.assertEqual(dataset_with_access_entry3, dataset_with_access_entry_from_dict3)
+        self.assertNotEqual(dataset_with_access_entry3, dataset_with_access_entry_from_dict1)
+        self.assertNotEqual(dataset_with_access_entry3, dataset_with_access_entry_from_dict2)
+        self.assertEqual(dataset_with_access_entry4, dataset_with_access_entry_from_dict4)
+        self.assertEqual(dataset_with_access_entry1, dataset_with_access_entry_from_dict4)
+        self.assertEqual(dataset_with_access_entry4, dataset_with_access_entry_from_dict1)
diff --git a/tests/test_util.py b/tests/test_util.py
index 618d9b0..c609b81 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 import unittest
 
-from bqdm.model import BigQueryDataset, BigQueryAccessGrant
+from bqdm.model import BigQueryDataset, BigQueryAccessEntry
 from bqdm.util import dump_dataset
 
 
@@ -22,11 +22,11 @@ friendly_name: test_friendly_name
 description: test_description
 default_table_expiration_ms: 43200000
 location: US
-access_grants: null
+access_entries: null
 """
         self.assertEqual(actual_dump_data1, expected_dump_data1)
 
-        access_grant2 = BigQueryAccessGrant(
+        access_entry2 = BigQueryAccessEntry(
             'OWNER',
             'specialGroup',
             'projectOwners'
@@ -37,7 +37,7 @@ access_grants: null
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant2]
+            [access_entry2]
         )
         actual_dump_data2 = dump_dataset(dataset2)
         expected_dump_data2 = """name: test2
@@ -45,14 +45,14 @@ friendly_name: test_friendly_name
 description: test_description
 default_table_expiration_ms: 43200000
 location: US
-access_grants:
+access_entries:
 -   role: OWNER
     entity_type: specialGroup
     entity_id: projectOwners
 """
         self.assertEqual(actual_dump_data2, expected_dump_data2)
 
-        access_grant3 = BigQueryAccessGrant(
+        access_entry3 = BigQueryAccessEntry(
             None,
             'view',
             {
@@ -67,7 +67,7 @@ access_grants:
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant3]
+            [access_entry3]
         )
         actual_dump_data3 = dump_dataset(dataset3)
         expected_dump_data3 = """name: test3
@@ -75,7 +75,7 @@ friendly_name: test_friendly_name
 description: test_description
 default_table_expiration_ms: 43200000
 location: US
-access_grants:
+access_entries:
 -   role: null
     entity_type: view
     entity_id:
@@ -91,7 +91,7 @@ access_grants:
             'test_description',
             24 * 30 * 60 * 1000,
             'US',
-            [access_grant2, access_grant3]
+            [access_entry2, access_entry3]
         )
         actual_dump_data4 = dump_dataset(dataset4)
         expected_dump_data4 = """name: test4
@@ -99,7 +99,7 @@ friendly_name: test_friendly_name
 description: test_description
 default_table_expiration_ms: 43200000
 location: US
-access_grants:
+access_entries:
 -   role: OWNER
     entity_type: specialGroup
     entity_id: projectOwners