#NEWLINE# def test_add_app_statistics( self ) : #NEWLINE# #INDENT# userid1 = '{F07B3878-CD6F-4B96-B52F-95C4D23077E0}' #NEWLINE# user1_id = get_id ( userid1 ) #NEWLINE# userid2 = '{EC4C5647-F798-4BCA-83DA-926CD448A1D5}' #NEWLINE# user2_id = get_id ( userid2 ) #NEWLINE# appid = '{F97917B1-19AB-48C1-9802-CEF305B10804}' #NEWLINE# version = '0.0.0.1' #NEWLINE# channel = 'test' #NEWLINE# test_app = dict ( appid = appid , version = version , tag = channel ) #NEWLINE# install_app_events = DayEvents ( ( 'new_install:%s' % appid ) ) #NEWLINE# request_app_events = DayEvents ( ( 'request:%s' % appid ) ) #NEWLINE# request_version_events = DayEvents ( 'request:{}:{}' . format ( appid , version ) ) #NEWLINE# install_platform_events = DayEvents ( 'new_install:{}:{}' . format ( appid , 'mac' ) ) #NEWLINE# request_platform_events = DayEvents ( 'request:{}:{}' . format ( appid , 'mac' ) ) #NEWLINE# request_channel_events = DayEvents ( 'request:{}:{}' . format ( appid , channel ) ) #NEWLINE# request_platform_version_events = DayEvents ( 'request:{}:{}:{}' . format ( appid , 'mac' , version ) ) #NEWLINE# self . assertFalse ( ( user1_id in install_app_events ) ) #NEWLINE# self . assertEqual ( len ( install_app_events ) , 0 ) #NEWLINE# self . assertFalse ( ( user1_id in install_platform_events ) ) #NEWLINE# self . assertEqual ( len ( install_platform_events ) , 0 ) #NEWLINE# self . assertFalse ( ( user1_id in request_app_events ) ) #NEWLINE# self . assertEqual ( len ( request_app_events ) , 0 ) #NEWLINE# self . assertFalse ( ( user1_id in request_platform_events ) ) #NEWLINE# self . assertEqual ( len ( request_platform_events ) , 0 ) #NEWLINE# self . assertFalse ( ( user1_id in request_version_events ) ) #NEWLINE# self . assertEqual ( len ( request_version_events ) , 0 ) #NEWLINE# self . assertFalse ( ( user1_id in request_channel_events ) ) #NEWLINE# self . assertEqual ( len ( request_channel_events ) , 0 ) #NEWLINE# self . assertFalse ( ( user1_id in request_platform_version_events ) ) #NEWLINE# self . assertEqual ( len ( request_platform_version_events ) , 0 ) #NEWLINE# add_app_statistics ( user1_id , 'mac' , test_app ) #NEWLINE# self . assertTrue ( ( user1_id in install_app_events ) ) #NEWLINE# self . assertEqual ( len ( install_app_events ) , 1 ) #NEWLINE# self . assertFalse ( ( user1_id in request_app_events ) ) #NEWLINE# self . assertEqual ( len ( request_app_events ) , 0 ) #NEWLINE# self . assertFalse ( ( user1_id in request_platform_events ) ) #NEWLINE# self . assertEqual ( len ( request_platform_events ) , 0 ) #NEWLINE# self . assertTrue ( ( user1_id in request_version_events ) ) #NEWLINE# self . assertEqual ( len ( request_version_events ) , 1 ) #NEWLINE# self . assertTrue ( ( user1_id in install_platform_events ) ) #NEWLINE# self . assertEqual ( len ( install_platform_events ) , 1 ) #NEWLINE# self . assertTrue ( ( user1_id in request_channel_events ) ) #NEWLINE# self . assertEqual ( len ( request_channel_events ) , 1 ) #NEWLINE# self . assertTrue ( ( user1_id in request_platform_version_events ) ) #NEWLINE# self . assertEqual ( len ( request_platform_version_events ) , 1 ) #NEWLINE# add_app_statistics ( user2_id , 'mac' , test_app ) #NEWLINE# self . assertTrue ( ( user2_id in install_app_events ) ) #NEWLINE# self . assertEqual ( len ( install_app_events ) , 2 ) #NEWLINE# self . assertFalse ( ( user2_id in request_app_events ) ) #NEWLINE# self . assertEqual ( len ( request_app_events ) , 0 ) #NEWLINE# self . assertFalse ( ( user2_id in request_platform_events ) ) #NEWLINE# self . assertEqual ( len ( request_platform_events ) , 0 ) #NEWLINE# self . assertTrue ( ( user2_id in request_version_events ) ) #NEWLINE# self . assertEqual ( len ( request_version_events ) , 2 ) #NEWLINE# self . assertTrue ( ( user2_id in install_platform_events ) ) #NEWLINE# self . assertEqual ( len ( install_platform_events ) , 2 ) #NEWLINE# self . assertTrue ( ( request_channel_events in request_channel_events ) ) #NEWLINE# self . assertEqual ( len ( request_channel_events ) , 2 ) #NEWLINE# self . assertTrue ( ( user2_id in request_platform_version_events ) ) #NEWLINE# self . assertEqual ( len ( request_platform_version_events ) , 2 ) #NEWLINE# add_app_statistics ( user1_id , 'mac' , test_app ) #NEWLINE# self . assertTrue ( ( user1_id in install_app_events ) ) #NEWLINE# self . assertEqual ( len ( install_app_events ) , 2 ) #NEWLINE# self . assertFalse ( ( user1_id in request_app_events ) ) #NEWLINE# self . assertEqual ( len ( request_app_events ) , 0 ) #NEWLINE# self . assertFalse ( ( user1_id in request_platform_events ) ) #NEWLINE# self . assertEqual ( len ( request_platform_events ) , 0 ) #NEWLINE# self . assertTrue ( ( user1_id in request_version_events ) ) #NEWLINE# self . assertEqual ( len ( request_version_events ) , 2 ) #NEWLINE# self . assertTrue ( ( user1_id in install_platform_events ) ) #NEWLINE# self . assertEqual ( len ( install_platform_events ) , 2 ) #NEWLINE# self . assertTrue ( ( user1_id in request_channel_events ) ) #NEWLINE# self . assertEqual ( len ( request_channel_events ) , 2 ) #NEWLINE# self . assertTrue ( ( user1_id in request_platform_version_events ) ) #NEWLINE# self . assertEqual ( len ( request_platform_version_events ) , 2 )