Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gcloud/pubsub/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
class Connection(base_connection.JSONConnection):
"""A connection to Google Cloud Pubsub via the JSON REST API."""

API_BASE_URL = base_connection.API_BASE_URL
API_BASE_URL = 'https://pubsub.googleapis.com'
"""The base of the API call URL."""

API_VERSION = 'v1beta2'
"""The version of the API, used in building the API call's URL."""

API_URL_TEMPLATE = '{api_base_url}/pubsub/{api_version}{path}'
API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
"""A template for the URL of a particular API call."""
3 changes: 1 addition & 2 deletions gcloud/pubsub/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def test_build_api_url_no_extra_query_params(self):
conn = self._makeOne()
URI = '/'.join([
conn.API_BASE_URL,
'pubsub',
conn.API_VERSION,
'foo',
])
Expand All @@ -42,6 +41,6 @@ def test_build_api_url_w_extra_query_params(self):
scheme, netloc, path, qs, _ = urlsplit(uri)
self.assertEqual('%s://%s' % (scheme, netloc), conn.API_BASE_URL)
self.assertEqual(path,
'/'.join(['', 'pubsub', conn.API_VERSION, 'foo']))
'/'.join(['', conn.API_VERSION, 'foo']))
parms = dict(parse_qsl(qs))
self.assertEqual(parms['bar'], 'baz')
42 changes: 42 additions & 0 deletions regression/pubsub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest2

from gcloud import _helpers
from gcloud import pubsub
from gcloud.pubsub.topic import Topic


_helpers._PROJECT_ENV_VAR_NAME = 'GCLOUD_TESTS_PROJECT_ID'
pubsub.set_defaults()


class TestPubsubTopics(unittest2.TestCase):

def setUp(self):
self.to_delete = []

def tearDown(self):
for doomed in self.to_delete:
doomed.delete()

def test_create_topic(self):
new_topic_name = 'a-new-topic'
topic = Topic(new_topic_name)
self.assertFalse(topic.exists())
topic.create()
self.to_delete.append(topic)
self.assertTrue(topic.exists())
self.assertEqual(topic.name, new_topic_name)
2 changes: 1 addition & 1 deletion regression/run_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_parser():
parser = argparse.ArgumentParser(
description='GCloud test runner against actual project.')
parser.add_argument('--package', dest='package',
choices=('datastore', 'storage'),
choices=('datastore', 'storage', 'pubsub'),
default='datastore', help='Package to be tested.')
return parser

Expand Down
1 change: 1 addition & 0 deletions scripts/run_regression.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ fi
# Run the regression tests for each tested package.
python regression/run_regression.py --package datastore
python regression/run_regression.py --package storage
python regression/run_regression.py --package pubsub