#NEWLINE# @ mock_sns #NEWLINE# def test_subscription_paging( ) : #NEWLINE# #INDENT# conn = boto . connect_sns ( ) #NEWLINE# conn . create_topic ( 'topic1' ) #NEWLINE# conn . create_topic ( 'topic2' ) #NEWLINE# topics_json = conn . get_all_topics ( ) #NEWLINE# topics = topics_json [ 'ListTopicsResponse' ] [ 'ListTopicsResult' ] [ 'Topics' ] #NEWLINE# topic1_arn = topics [ 0 ] [ 'TopicArn' ] #NEWLINE# topic2_arn = topics [ 1 ] [ 'TopicArn' ] #NEWLINE# for index in range ( ( DEFAULT_PAGE_SIZE + int ( ( DEFAULT_PAGE_SIZE / 3 ) ) ) ) : #NEWLINE# #INDENT# conn . subscribe ( topic1_arn , 'email' , ( ( 'email_' + str ( index ) ) + '@test.com' ) ) #NEWLINE# conn . subscribe ( topic2_arn , 'email' , ( ( 'email_' + str ( index ) ) + '@test.com' ) ) #NEWLINE# #UNINDENT# all_subscriptions = conn . get_all_subscriptions ( ) #NEWLINE# all_subscriptions [ 'ListSubscriptionsResponse' ] [ 'ListSubscriptionsResult' ] [ 'Subscriptions' ] . should . have . length_of ( DEFAULT_PAGE_SIZE ) #NEWLINE# next_token = all_subscriptions [ 'ListSubscriptionsResponse' ] [ 'ListSubscriptionsResult' ] [ 'NextToken' ] #NEWLINE# next_token . should . equal ( DEFAULT_PAGE_SIZE ) #NEWLINE# all_subscriptions = conn . get_all_subscriptions ( next_token = ( next_token * 2 ) ) #NEWLINE# all_subscriptions [ 'ListSubscriptionsResponse' ] [ 'ListSubscriptionsResult' ] [ 'Subscriptions' ] . should . have . length_of ( int ( ( ( DEFAULT_PAGE_SIZE * 2 ) / 3 ) ) ) #NEWLINE# next_token = all_subscriptions [ 'ListSubscriptionsResponse' ] [ 'ListSubscriptionsResult' ] [ 'NextToken' ] #NEWLINE# next_token . should . equal ( None ) #NEWLINE# topic1_subscriptions = conn . get_all_subscriptions_by_topic ( topic1_arn ) #NEWLINE# topic1_subscriptions [ 'ListSubscriptionsByTopicResponse' ] [ 'ListSubscriptionsByTopicResult' ] [ 'Subscriptions' ] . should . have . length_of ( DEFAULT_PAGE_SIZE ) #NEWLINE# next_token = topic1_subscriptions [ 'ListSubscriptionsByTopicResponse' ] [ 'ListSubscriptionsByTopicResult' ] [ 'NextToken' ] #NEWLINE# next_token . should . equal ( DEFAULT_PAGE_SIZE ) #NEWLINE# topic1_subscriptions = conn . get_all_subscriptions_by_topic ( topic1_arn , next_token = next_token ) #NEWLINE# topic1_subscriptions [ 'ListSubscriptionsByTopicResponse' ] [ 'ListSubscriptionsByTopicResult' ] [ 'Subscriptions' ] . should . have . length_of ( int ( ( DEFAULT_PAGE_SIZE / 3 ) ) ) #NEWLINE# next_token = topic1_subscriptions [ 'ListSubscriptionsByTopicResponse' ] [ 'ListSubscriptionsByTopicResult' ] [ 'NextToken' ] #NEWLINE# next_token . should . equal ( None )