#NEWLINE# def test_run_json_dump( mocker , mock_ensure_success , mock_user_config , template_name , context , replay_test_dir , replay_file ) : #NEWLINE# #INDENT# 'Test that replay.dump runs json.dump under the hood and that the context\n    is correctly written to the expected file in the replay_dir.\n    ' #NEWLINE# spy_get_replay_file = mocker . spy ( replay , 'get_file_name' ) #NEWLINE# mock_json_dump = mocker . patch ( 'json.dump' , side_effect = json . dump ) #NEWLINE# replay . dump ( replay_test_dir , template_name , replay_file ) #NEWLINE# assert ( not mock_user_config . called ) #NEWLINE# mock_ensure_success . assert_called_once_with ( replay_test_dir ) #NEWLINE# spy_get_replay_file . assert_called_once_with ( replay_test_dir , template_name ) #NEWLINE# assert ( mock_json_dump . call_count == 1 ) #NEWLINE# ( ( dumped_context , outfile_handler ) , kwargs ) = mock_json_dump . call_args #NEWLINE# assert ( outfile_handler . name == replay_file ) #NEWLINE# assert ( dumped_context == context )