-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1831 from tseaver/bigquery-testable_snippets_prep
Prepare for making snippets testable
- Loading branch information
Showing
6 changed files
with
96 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,26 @@ def test_ctor_nonview_without_role(self): | |
with self.assertRaises(ValueError): | ||
self._makeOne(role, entity_type, None) | ||
|
||
def test___eq___role_mismatch(self): | ||
grant = self._makeOne('OWNER', 'userByEmail', '[email protected]') | ||
other = self._makeOne('WRITER', 'userByEmail', '[email protected]') | ||
self.assertNotEqual(grant, other) | ||
|
||
def test___eq___entity_type_mismatch(self): | ||
grant = self._makeOne('OWNER', 'userByEmail', '[email protected]') | ||
other = self._makeOne('OWNER', 'groupByEmail', '[email protected]') | ||
self.assertNotEqual(grant, other) | ||
|
||
def test___eq___entity_id_mismatch(self): | ||
grant = self._makeOne('OWNER', 'userByEmail', '[email protected]') | ||
other = self._makeOne('OWNER', 'userByEmail', '[email protected]') | ||
self.assertNotEqual(grant, other) | ||
|
||
def test___eq___hit(self): | ||
grant = self._makeOne('OWNER', 'userByEmail', '[email protected]') | ||
other = self._makeOne('OWNER', 'userByEmail', '[email protected]') | ||
self.assertEqual(grant, other) | ||
|
||
|
||
class TestDataset(unittest2.TestCase): | ||
PROJECT = 'project' | ||
|
@@ -138,8 +158,11 @@ def _verifyResourceProperties(self, dataset, resource): | |
|
||
self._verifyReadonlyResourceProperties(dataset, resource) | ||
|
||
self.assertEqual(dataset.default_table_expiration_ms, | ||
resource.get('defaultTableExpirationMs')) | ||
if 'defaultTableExpirationMs' in resource: | ||
self.assertEqual(dataset.default_table_expiration_ms, | ||
int(resource.get('defaultTableExpirationMs'))) | ||
else: | ||
self.assertEqual(dataset.default_table_expiration_ms, None) | ||
self.assertEqual(dataset.description, resource.get('description')) | ||
self.assertEqual(dataset.friendly_name, resource.get('friendlyName')) | ||
self.assertEqual(dataset.location, resource.get('location')) | ||
|
@@ -500,7 +523,7 @@ def test_patch_w_alternate_client(self): | |
DEF_TABLE_EXP = 12345 | ||
LOCATION = 'EU' | ||
RESOURCE = self._makeResource() | ||
RESOURCE['defaultTableExpirationMs'] = DEF_TABLE_EXP | ||
RESOURCE['defaultTableExpirationMs'] = str(DEF_TABLE_EXP) | ||
RESOURCE['location'] = LOCATION | ||
conn1 = _Connection() | ||
CLIENT1 = _Client(project=self.PROJECT, connection=conn1) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters