예제 #1
0
    def test_preset_errors(self):
        TaskPreset.drop_table()
        with self.assertLogs(logger, level="WARNING"):
            delete_task_preset("NewTask", "NewPreset")

        with self.assertLogs(logger, level="WARNING"):
            save_task_preset("NewTask", "NewPreset", "data")
예제 #2
0
    def test_task_preset(self):
        save_task_preset("NewPreset", "NewTask", "Data number1")

        presets = get_task_presets("NewTask")
        assert len(presets) == 1
        assert presets["NewPreset"] == "Data number1"

        data = {"data1": "abc", "data2": 1313}
        save_task_preset("NewPreset2", "NewTask", data)
        presets = get_task_presets("NewTask")
        assert len(presets) == 2
        assert presets["NewPreset"] == "Data number1"
        assert presets["NewPreset2"]["data2"] == 1313

        save_task_preset("NewPreset", "NewTask", "Data number2")
        presets = get_task_presets("NewTask")
        assert len(presets) == 2
        assert presets["NewPreset"] == "Data number2"

        save_task_preset("NewPreset", "NewTask2", "Data number3")
        presets = get_task_presets("NewTask")
        assert len(presets) == 2
        assert presets["NewPreset"] == "Data number2"
        presets = get_task_presets("NewTask2")
        assert len(presets) == 1
        assert presets["NewPreset"] == "Data number3"

        delete_task_preset("NewTask", "NewPreset")
        presets = get_task_presets("NewTask2")
        assert len(presets) == 1
        presets = get_task_presets("NewTask")
        assert len(presets) == 1
예제 #3
0
 def save_task_preset(preset_name, task_type, data):
     taskpreset.save_task_preset(preset_name, task_type, data)