def test_create_computation_template_should_log_error_if_computation_id_is_missing( self, mock_logger, mock_backend_response, ): # pylint: disable=no-self-use MOCK_CREATE_ANALYSIS_RESPONSE = TestJSONResponse(content=({ 'user': 2, 'id': 1, }), status_code=200) MOCK_REACTION_NETWORK_RESPONSE = TestJSONResponse(content=({ 'user': 2, 'analysis': 1, 'status': 'SUCCESS' }), status_code=200) mock_backend_response.side_effect = (MOCK_CREATE_ANALYSIS_RESPONSE, MOCK_REACTION_NETWORK_RESPONSE) scenario = 'create-reaction-network' url = 'test_url' token = 'dummy' scenario_args = {} create_computation_and_get_results(scenario, url, token, scenario_args) self.assertEqual(mock_logger.error.call_count, 1)
def test_create_computation_template_should_patch_name_if_name_arg_present_and_scenario_is_with_analysis_scenario( self, mock_backend_response, mock_patch, ): # pylint: disable=no-self-use mock_backend_response.return_value = MANUAL_RETRO_RESPONSE scenario = 'create-reaction-network-with-analysis' url = 'test_url' token = 'dummy' scenario_args = {'name': 'test_name'} create_computation_and_get_results(scenario, url, token, scenario_args) mock_patch.assert_called_with(url, token, { 'computation-id': 294, 'analysis-id': 348, 'name': 'test_name' })
def run_greedy_popularity_and_wait_for_success(url, scenario_args): return create_computation_and_get_results('create-greedy-popularity', url, scenario_args)
def run_manual_retro_and_wait_for_success(url, token, scenario_args): return create_computation_and_get_results('create-manual-retro', url, token, scenario_args)
def run_syntaurus_and_wait_for_success(url, scenario_args): return create_computation_and_get_results('create-syntaurus', url, scenario_args)
def run_reaction_network_with_analysis_and_wait_for_success( url, token, scenario_args): return create_computation_and_get_results( 'create-reaction-network-with-analysis', url, token, scenario_args)
def run_minimal_cost_and_wait_for_success(url, token, scenario_args): return create_computation_and_get_results('create-minimal-cost', url, token, scenario_args)
def run_reverse_reaction_network_and_wait_for_success(url, token, scenario_args): return create_computation_and_get_results( 'create-reverse-reaction-network', url, token, scenario_args)
def run_travel_as_reactant_and_wait_for_success(url, scenario_args): return create_computation_and_get_results('create-travel-as-reactant', url, scenario_args)
def run_cost_and_popularity_and_wait_for_success(url, token, scenario_args): return create_computation_and_get_results('create-cost-and-popularity', url, token, scenario_args)