def test_before_experiment_control(push_execution, session): # arrange experiment = data.provide_experiment() settings = data.provide_settings() push_execution.return_value = {"id": "12345"} # act controls.before_experiment_control(context=experiment, configuration={}, secrets={}, settings=settings) assert settings.get('run_context').get('execution').get('id') == "12345" push_execution.assert_called_once_with(settings, ANY)
def test_before_method_control(publish_event, session): # arrange experiment = data.provide_experiment() settings = data.provide_settings() # act controls.before_method_control(context=experiment, state=None, configuration={}, secrets={}, settings=settings) publish_event.assert_called_once_with("before-method", experiment, None, settings, ANY)
def test_after_experiment_control(publish_event, session): # arrange experiment = data.provide_experiment() settings = data.provide_settings() journal = data.provide_journal() # act controls.after_experiment_control(context=experiment, state=journal, configuration={}, secrets={}, settings=settings) publish_event.assert_called_once_with("after-experiment", None, journal, settings, ANY)
def test_after_rollback_control(publish_event, session): # arrange experiment = data.provide_experiment() settings = data.provide_settings() method_outcome = [{"result": "maybe"}] # act controls.after_rollback_control(context=experiment, state=method_outcome, configuration={}, secrets={}, settings=settings) publish_event.assert_called_once_with("after-rollback", experiment, method_outcome, settings, ANY)