@snippet
def subscription_lifecycle(client, to_delete):
 TOPIC_NAME = ('subscription_lifecycle-%d' % (_millis(),))
 SUB_NAME = ('subscription_lifecycle-defaults-%d' % (_millis(),))
 topic = client.topic(TOPIC_NAME)
 topic.create()
 to_delete.append(topic)
 subscription = topic.subscription(SUB_NAME)
 subscription.create()
 assert subscription.exists()
 subscription.reload()
 subscription.delete()

@ snippet def subscription_lifecycle ( client , to_delete ) : TOPIC_NAME = ( 'subscription_lifecycle-%d' % ( _millis ( ) , ) ) SUB_NAME = ( 'subscription_lifecycle-defaults-%d' % ( _millis ( ) , ) ) topic = client . topic ( TOPIC_NAME ) topic . create ( ) to_delete . append ( topic ) subscription = topic . subscription ( SUB_NAME ) subscription . create ( ) assert subscription . exists ( ) subscription . reload ( ) subscription . delete ( )
test lifecycle of a subscription .