Uh oh!
There was an error while loading. Please reload this page.
Add '{Bucket,Blob}.user_project' properties. - #3490
Conversation
tseaver
commented
Jun 9, 2017
Rebased against master after the merge of #3488. |
dhermes
left a comment
There was a problem hiding this comment.
Pretty straightforward, mostly (totally?) just nits
| # Pass only '?projection=noAcl' here because 'acl' and related | ||
| # are handled via custom endpoints. | ||
| query_params = {'projection': 'noAcl'} | ||
| if self.user_project is not None: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| @property | ||
| def user_project(self): | ||
| """Project ID used for API requests made via this blob. | ||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| :type user_project: str | ||
| :param user_project: (Optional) the project ID to be billed for API | ||
| requests made via this instance. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| def user_project(self): | ||
| """Project ID to be billed for API requests made via this bucket. | ||
| If unset, API requests are billed to the bucket owner. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| mixin = self._make_one() | ||
| self.assertRaises(NotImplementedError, lambda: mixin.path) | ||
| with self.assertRaises(NotImplementedError): | ||
| mixin.path |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| connection = _Connection({'foo': 'Foo'}) | ||
| client = _Client(connection) | ||
| derived = self._derivedClass('/path', user_project)() | ||
| # Make sure changes is not a set, so we can observe a change. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| self.assertEqual(kw[0]['path'], '/path') | ||
| self.assertEqual( | ||
| kw[0]['query_params'], | ||
| {'projection': 'noAcl', 'userProject': user_project}) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| bucket = klass(client, name=NAME, user_project=USER_PROJECT) | ||
| self.assertEqual(bucket.name, NAME) | ||
| self.assertEqual(bucket._properties, {}) | ||
| self.assertEqual(bucket.user_project, USER_PROJECT) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| kw[0]['query_params'], | ||
| {'projection': 'full', 'userProject': user_project}) | ||
| # Since changes does not include `baz`, we don't see it sent. | ||
| self.assertEqual(kw[0]['data'], {'bar': BAR}) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
dhermes
commented
Jun 12, 2017
LGTM after your comment update |
* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.* Add abstract '_PropertyMixin.user_project' property.
* Support 'user_project' in '_PropertyMixin.{reload,patch}'.
* Add 'user_project' param to 'Bucket.__init__'.
* Save and expose via read-only 'user_project' property.
* Implement 'Blob.user_property' via bucket's value.
Uses #3489 as a base.