def topic_check_iam_permissions(client, to_delete):
 TOPIC_NAME = ('topic_check_iam_permissions-%d' % (_millis(),))
 topic = client.topic(TOPIC_NAME)
 topic.create()
 to_delete.append(topic)
 from google.cloud.pubsub.iam import OWNER_ROLE, EDITOR_ROLE, VIEWER_ROLE
 TO_CHECK = [OWNER_ROLE, EDITOR_ROLE, VIEWER_ROLE]
 ALLOWED = topic.check_iam_permissions(TO_CHECK)
 assert (set(ALLOWED) == set(TO_CHECK))

def topic_check_iam_permissions ( client , to_delete ) : TOPIC_NAME = ( 'topic_check_iam_permissions-%d' % ( _millis ( ) , ) ) topic = client . topic ( TOPIC_NAME ) topic . create ( ) to_delete . append ( topic ) from google . cloud . pubsub . iam import OWNER_ROLE , EDITOR_ROLE , VIEWER_ROLE TO_CHECK = [ OWNER_ROLE , EDITOR_ROLE , VIEWER_ROLE ] ALLOWED = topic . check_iam_permissions ( TO_CHECK ) assert ( set ( ALLOWED ) == set ( TO_CHECK ) )
check topic iam permissions .