Skip to content

Commit

Permalink
Merge pull request #849 from tseaver/squelch-project_id
Browse files Browse the repository at this point in the history
For consistency, replace all use of `project_id` w/ `project`.
  • Loading branch information
tseaver committed Apr 30, 2015
2 parents d21bc3f + bede80f commit fb59514
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
6 changes: 3 additions & 3 deletions docs/pubsub-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Connection / Authorization

- credentials (derived from GAE / GCE environ if present).

- ``project_id`` (derived from GAE / GCE environ if present).
- ``project`` (derived from GAE / GCE environ if present).

- ``scopes``

Expand All @@ -29,7 +29,7 @@ Create a new topic for an explicit project:
.. doctest::

>>> from gcloud.pubsub import Topic
>>> topic = Topic('topic_name', project_id='my.project')
>>> topic = Topic('topic_name', project='my.project')
>>> topic.create() # API request

Check for the existance of a topic:
Expand All @@ -54,7 +54,7 @@ List topics for an explicit project:
.. doctest::

>>> from gcloud.pubsub import list_topics
>>> topics = list_topics(project_id='my.project') # API request
>>> topics = list_topics(project='my.project') # API request
>>> [topic.name for topic in topics]
['topic_name']

Expand Down
6 changes: 3 additions & 3 deletions gcloud/test__helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,13 @@ def close(self):

class _HTTPConnection(_BaseHTTPConnection):

def __init__(self, status, project_id):
def __init__(self, status, project):
super(_HTTPConnection, self).__init__()
self.status = status
self.project_id = project_id
self.project = project

def getresponse(self):
return _HTTPResponse(self.status, self.project_id)
return _HTTPResponse(self.status, self.project)


class _TimeoutHTTPConnection(_BaseHTTPConnection):
Expand Down
4 changes: 2 additions & 2 deletions regression/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def test_list_topics(self):

# Retrieve the topics.
all_topics, _ = pubsub.list_topics()
project_id = pubsub.get_default_project()
project = pubsub.get_default_project()
created = [topic for topic in all_topics
if topic.name in topics_to_create and
topic.project == project_id]
topic.project == project]
self.assertEqual(len(created), len(topics_to_create))

def test_create_subscription(self):
Expand Down
7 changes: 1 addition & 6 deletions regression/regression_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"""


def get_environ(require_datastore=False, require_storage=False):
def check_environ(require_datastore=False, require_storage=False):
if require_datastore:
if DATASET_ID is None or not os.path.isfile(CREDENTIALS):
print(ENVIRON_ERROR_MSG, file=sys.stderr)
Expand All @@ -38,8 +38,3 @@ def get_environ(require_datastore=False, require_storage=False):
if PROJECT_ID is None or not os.path.isfile(CREDENTIALS):
print(ENVIRON_ERROR_MSG, file=sys.stderr)
sys.exit(1)

return {
'project_id': PROJECT_ID,
'dataset_id': DATASET_ID,
}
4 changes: 2 additions & 2 deletions regression/run_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def main():
args = parser.parse_args()
# Make sure environ is set before running test.
if args.package == 'datastore':
regression_utils.get_environ(require_datastore=True)
regression_utils.check_environ(require_datastore=True)
elif args.package == 'storage':
regression_utils.get_environ(require_storage=True)
regression_utils.check_environ(require_storage=True)
test_result = run_module_tests(args.package)
if not test_result.wasSuccessful():
sys.exit(1)
Expand Down

0 comments on commit fb59514

Please sign in to comment.