#NEWLINE# def check_create_stats_user_logged( self , modification_api_call ) : #NEWLINE# #INDENT# self . env . create ( nodes_kwargs = [ { #NEWLINE# #INDENT# 'roles' : [ 'controller' ] , #NEWLINE# 'pending_addition' : True , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# task = self . env . launch_deployment ( ) #NEWLINE# self . assertEqual ( modification_api_call . status , consts . TASK_STATUSES . ready ) #NEWLINE# resp = self . app . get ( reverse ( 'MasterNodeSettingsHandler' ) , headers = self . default_headers ) #NEWLINE# data = resp . json_body #NEWLINE# self . assertFalse ( data [ 'settings' ] [ 'statistics' ] [ 'user_choice_saved' ] [ 'value' ] ) #NEWLINE# self . assertTrue ( data [ 'settings' ] [ 'statistics' ] [ 'send_anonymous_statistic' ] [ 'value' ] ) #NEWLINE# stat_settings = data [ 'settings' ] [ 'statistics' ] #NEWLINE# stat_settings [ 'user_choice_saved' ] [ 'value' ] = True #NEWLINE# stat_settings [ 'send_anonymous_statistic' ] [ 'value' ] = True #NEWLINE# resp = modification_api_call ( reverse ( 'MasterNodeSettingsHandler' ) , headers = self . default_headers , params = jsonutils . dumps ( data ) ) #NEWLINE# self . assertEqual ( 200 , resp . status_code ) #NEWLINE# tasks = objects . TaskCollection . filter_by ( None , name = consts . TASK_NAMES . create_stats_user ) . all ( ) #NEWLINE# tasks_count = len ( tasks ) #NEWLINE# task = tasks [ ( - 1 ) ] #NEWLINE# action_log = objects . ActionLogCollection . filter_by ( None , task_uuid = task . uuid ) #NEWLINE# self . assertIsNotNone ( action_log ) #NEWLINE# resp = self . app . get ( reverse ( 'MasterNodeSettingsHandler' ) , headers = self . default_headers ) #NEWLINE# new_data = resp . json_body #NEWLINE# self . assertTrue ( new_data [ 'settings' ] [ 'statistics' ] [ 'user_choice_saved' ] [ 'value' ] ) #NEWLINE# self . assertTrue ( new_data [ 'settings' ] [ 'statistics' ] [ 'send_anonymous_statistic' ] [ 'value' ] ) #NEWLINE# resp = modification_api_call ( reverse ( 'MasterNodeSettingsHandler' ) , headers = self . default_headers , params = jsonutils . dumps ( data ) ) #NEWLINE# self . assertEqual ( 200 , resp . status_code ) #NEWLINE# duplicate_call_tasks_count = objects . TaskCollection . filter_by ( None , name = consts . TASK_NAMES . create_stats_user ) . count ( ) #NEWLINE# self . assertEquals ( tasks_count , duplicate_call_tasks_count )