def _upload_from_file_helper(self, side_effect=None, **kwargs):
    from google.cloud._helpers import UTC
    blob = self._make_one('blob-name', bucket=None)
    created_json = {'updated': '2017-01-01T09:09:09.081Z'}
    blob._do_upload = mock.Mock(return_value=created_json, spec=[])
    if (side_effect is not None):
        blob._do_upload.side_effect = side_effect
    self.assertIsNone(blob.updated)
    data = b'data is here'
    stream = io.BytesIO(data)
    stream.seek(2)
    content_type = u'font/woff'
    client = mock.sentinel.client
    ret_val = blob.upload_from_file(stream, size=len(data), content_type=content_type, client=client, **kwargs)
    self.assertIsNone(ret_val)
    new_updated = datetime.datetime(2017, 1, 1, 9, 9, 9, 81000, tzinfo=UTC)
    self.assertEqual(blob.updated, new_updated)
    num_retries = kwargs.get('num_retries')
    blob._do_upload.assert_called_once_with(client, stream, content_type, len(data), num_retries)
    return stream
def _upload_from_file_helper(self, side_effect=None, **kwargs):
    from google.cloud._helpers import UTC
    blob = self._make_one('blob-name', bucket=None)
    created_json = {'updated': '2017-01-01T09:09:09.081Z'}
    blob._do_upload = mock.Mock(return_value=created_json, spec=[])
    if (side_effect is not None):
        blob._do_upload.side_effect = side_effect
    self.assertIsNone(blob.updated)
    data = b'data is here'
    stream = io.BytesIO(data)
    stream.seek(2)
    content_type = u'font/woff'
    client = mock.sentinel.client
    ret_val = blob.upload_from_file(stream, size=len(data), content_type=content_type, client=client, **kwargs)
    self.assertIsNone(ret_val)
    new_updated = datetime.datetime(2017, 1, 1, 9, 9, 9, 81000, tzinfo=UTC)
    self.assertEqual(blob.updated, new_updated)
    num_retries = kwargs.get('num_retries')
    blob._do_upload.assert_called_once_with(client, stream, content_type, len(data), num_retries)
    return stream