#NEWLINE# def test_metrics_since_history( self ) : #NEWLINE# #INDENT# 'Tests the ``metrics_since`` template tag when displaying metric\n        history.' #NEWLINE# slug = 'test-slug' #NEWLINE# years = 5 #NEWLINE# link_type = 'history' #NEWLINE# now = datetime ( 2014 , 7 , 4 ) #NEWLINE# module = 'redis_metrics.templatetags.redis_metric_tags.datetime' #NEWLINE# with patch ( module ) as mock_datetime : #NEWLINE# #INDENT# mock_datetime . utcnow . return_value = now #NEWLINE# result = taglib . metrics_since ( slug , years , link_type ) #NEWLINE# self . assertIn ( 'link_type' , result . keys ( ) ) #NEWLINE# self . assertIn ( 'slug_values' , result . keys ( ) ) #NEWLINE# self . assertEqual ( result [ 'link_type' ] , link_type ) #NEWLINE# expected = [ ( slug , ( now - timedelta ( days = 1 ) ) , 'Today' , 'daily' ) , ( slug , ( now - timedelta ( days = 7 ) ) , '1 Week' , 'daily' ) , ( slug , ( now - timedelta ( days = 30 ) ) , '30 Days' , 'daily' ) , ( slug , ( now - timedelta ( days = 60 ) ) , '60 Days' , 'daily' ) , ( slug , ( now - timedelta ( days = 90 ) ) , '90 Days' , 'daily' ) , ( slug , ( now - timedelta ( days = 365 ) ) , '1 Years' , 'daily' ) , ( slug , ( now - timedelta ( days = ( 365 * 2 ) ) ) , '2 Years' , 'daily' ) , ( slug , ( now - timedelta ( days = ( 365 * 3 ) ) ) , '3 Years' , 'daily' ) , ( slug , ( now - timedelta ( days = ( 365 * 4 ) ) ) , '4 Years' , 'daily' ) , ( slug , ( now - timedelta ( days = ( 365 * 5 ) ) ) , '5 Years' , 'daily' ) ] #NEWLINE# self . assertEqual ( expected , result [ 'slug_values' ] )