Exemple #1
0
    def test_run_scenario_once_without_scenario_output(self, mock_clients,
                                                       mock_rutils):
        mock_rutils.Timer = fakes.FakeTimer
        context = base._get_scenario_context(fakes.FakeUserContext({}).context)
        args = (1, fakes.FakeScenario, "do_it", context, {})
        result = base._run_scenario_once(args)

        expected_result = {
            "duration": fakes.FakeTimer().duration(),
            "idle_duration": 0,
            "error": [],
            "scenario_output": {"errors": "", "data": {}},
            "atomic_actions": []
        }
        self.assertEqual(expected_result, result)
Exemple #2
0
 def test_run_scenario_once_exception(self, mock_clients, mock_rutils):
     mock_rutils.Timer = fakes.FakeTimer
     context = base._get_scenario_context(fakes.FakeUserContext({}).context)
     args = (1, fakes.FakeScenario, "something_went_wrong", context, {})
     result = base._run_scenario_once(args)
     expected_error = result.pop("error")
     expected_result = {
         "duration": fakes.FakeTimer().duration(),
         "idle_duration": 0,
         "scenario_output": {"errors": "", "data": {}},
         "atomic_actions": []
     }
     self.assertEqual(expected_result, result)
     self.assertEqual(expected_error[:2],
                      [str(Exception), "Something went wrong"])