예제 #1
0
    def test_action_with_empty_scenarios_names(self):
        user = Mock()
        user.forms = Mock()

        user.last_scenarios.last_scenario_name = "test_scenario"

        action = ClearScenarioByIdAction({})
        result = action.run(user, {}, {})
        self.assertIsNone(result)
        user.last_scenarios.delete.assert_not_called()
        user.forms.remove_item.assert_not_called()
예제 #2
0
    def test_action(self):
        scenario_name = "test_scenario"
        user = Mock()
        user.forms = Mock()

        user.last_scenarios.last_scenario_name = scenario_name
        scenario = Mock()
        scenario.form_type = scenario_name
        user.descriptions = {"scenarios": {scenario_name: scenario}}

        action = ClearScenarioByIdAction({"scenario_id": scenario_name})
        result = action.run(user, {}, {})
        self.assertIsNone(result)
        user.last_scenarios.delete.assert_called_once()
        user.forms.remove_item.assert_called_once()