Beispiel #1
0
 def test_scenario_action_without_jinja(self):
     action = RunScenarioAction({"scenario": "next_scenario"})
     user = Mock()
     user.parametrizer = MockParametrizer(user, {})
     scen = Mock()
     scen_result = 'done'
     scen.run.return_value = scen_result
     user.descriptions = {"scenarios": {"next_scenario": scen}}
     result = action.run(user, Mock())
     self.assertEqual(result, scen_result)
Beispiel #2
0
 def test_scenario_action_no_scenario(self):
     action = RunScenarioAction({"scenario": "{{next_scenario}}"})
     user = PicklableMock()
     user.parametrizer = MockParametrizer(user, {})
     scen = PicklableMock()
     scen_result = 'done'
     scen.run.return_value = scen_result
     user.descriptions = {"scenarios": {"next_scenario": scen}}
     result = action.run(user, PicklableMock())
     self.assertEqual(result, None)
Beispiel #3
0
    def test_scenario_action_with_jinja_good(self):
        params = {'next_scenario': 'ANNA.pipeline.scenario'}
        items = {"scenario": "{{next_scenario}}"}

        action = RunScenarioAction(items)
        user = Mock()
        user.parametrizer = MockParametrizer(user, {"data": params})
        scen = Mock()
        scen_result = 'done'
        scen.run.return_value = scen_result
        user.descriptions = {"scenarios": {"ANNA.pipeline.scenario": scen}}
        result = action.run(user, Mock())
        self.assertEqual(result, scen_result)