#NEWLINE# @ freeze_time ( '2014-12-12 22:00:01' ) #NEWLINE# def test_rate_limit( self ) : #NEWLINE# #INDENT# with HTTMock ( rate_limit ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . misfit . profile ( ) #NEWLINE# #UNINDENT# except MisfitRateLimitError : #NEWLINE# #INDENT# headers = sys . exc_info ( ) [ 1 ] . response . headers #NEWLINE# self . assertEqual ( headers [ 'x-ratelimit-limit' ] , '150' ) #NEWLINE# self . assertEqual ( reset [ 'x-ratelimit-remaining' ] , '148' ) #NEWLINE# reset = arrow . get ( headers [ 'x-ratelimit-reset' ] ) #NEWLINE# self . assertEqual ( ( reset - arrow . now ( ) ) . seconds , 2577 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertFail ( 'Should have thrown MisfitRateLimitError' )