Skip to content

Commit

Permalink
Merge pull request #1748 from dhermes/pubsub-emulator-skip-iam
Browse files Browse the repository at this point in the history
Skipping IAM system tests when running in emulator.
  • Loading branch information
dhermes committed Apr 27, 2016
2 parents 4ddec32 + 12e01e9 commit 6563cb7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions system_tests/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,16 @@ def _by_timestamp(message):
self.assertEqual(message2.data, MESSAGE_2)
self.assertEqual(message2.attributes['extra'], EXTRA_2)

def _maybe_emulator_skip(self):
# NOTE: We check at run-time rather than using the @unittest2.skipIf
# decorator. This matches the philosophy behind using
# setUpModule to determine the environment at run-time
# rather than at import time.
if os.getenv(PUBSUB_EMULATOR) is not None:
self.skipTest('IAM not supported by Pub/Sub emulator')

def test_topic_iam_policy(self):
self._maybe_emulator_skip()
topic_name = 'test-topic-iam-policy-topic' + unique_resource_id('-')
topic = Config.CLIENT.topic(topic_name)
topic.create()
Expand All @@ -187,6 +196,7 @@ def test_topic_iam_policy(self):
self.assertEqual(new_policy.viewers, policy.viewers)

def test_subscription_iam_policy(self):
self._maybe_emulator_skip()
topic_name = 'test-sub-iam-policy-topic' + unique_resource_id('-')
topic = Config.CLIENT.topic(topic_name)
topic.create()
Expand Down

0 comments on commit 6563cb7

Please sign in to comment.