예제 #1
0
 def get_steps(self):
     """
     :rtype Iterable[Step]
     """
     if getattr(self, "_steps", None) is None:
         from shoop.notify.script import Step
         self._steps = [Step.unserialize(data) for data in self._step_data]
     return self._steps
예제 #2
0
파일: script.py 프로젝트: cuberskulk/shoop
 def get_steps(self):
     """
     :rtype Iterable[Step]
     """
     if getattr(self, "_steps", None) is None:
         from shoop.notify.script import Step
         self._steps = [Step.unserialize(data) for data in self._step_data]
     return self._steps
예제 #3
0
def test_load_save():
    sc = Script(event_identifier=TestEvent.identifier, name="Test Script")
    assert force_text(sc) == "Test Script"
    sc.set_serialized_steps(TEST_STEP_DATA)
    sc.save()
    sc = Script.objects.get(pk=sc.pk)

    first_step = sc.get_steps()[0]
    first_step_data = TEST_STEP_DATA[0]
    step_from_data = Step.unserialize(first_step_data)
    data_from_step = first_step.serialize()

    assert data_from_step == first_step_data
    assert first_step == step_from_data
예제 #4
0
def test_load_save():
    sc = Script(event_identifier=TestEvent.identifier, name="Test Script")
    assert force_text(sc) == "Test Script"
    sc.set_serialized_steps(TEST_STEP_DATA)
    sc.save()
    sc = Script.objects.get(pk=sc.pk)

    first_step = sc.get_steps()[0]
    first_step_data = TEST_STEP_DATA[0]
    step_from_data = Step.unserialize(first_step_data)
    data_from_step = first_step.serialize()

    assert data_from_step == first_step_data
    assert first_step == step_from_data