#NEWLINE# def test_limited_request_json( self ) : #NEWLINE# #INDENT# request = webob . Request . blank ( '/' ) #NEWLINE# response = request . get_response ( self . app ) #NEWLINE# self . assertEqual ( 200 , response . status_int ) #NEWLINE# request = webob . Request . blank ( '/' ) #NEWLINE# response = request . get_response ( self . app ) #NEWLINE# self . assertEqual ( response . status_int , 429 ) #NEWLINE# self . assertIn ( 'Retry-After' , response . headers ) #NEWLINE# retry_after = int ( response . headers [ 'Retry-After' ] ) #NEWLINE# self . assertAlmostEqual ( retry_after , 60 , 1 ) #NEWLINE# body = jsonutils . loads ( response . body ) #NEWLINE# expected = 'Only 1 GET request(s) can be made to * every minute.' #NEWLINE# value = body [ 'overLimit' ] [ 'details' ] . strip ( ) #NEWLINE# self . assertEqual ( value , expected ) #NEWLINE# self . assertIn ( 'retryAfter' , body [ 'overLimit' ] ) #NEWLINE# retryAfter = body [ 'overLimit' ] [ 'retryAfter' ] #NEWLINE# self . assertEqual ( retry_after , '60' )