예제 #1
0
    def test_render_event_name__accepts_many_finalizers(self):

        assert CreateOrUpdate('Car').render_event_name(
            Mock(), EventFactory.Created()) == 'CAR_CREATED'

        assert CreateOrUpdate('Box').render_event_name(
            Mock(), EventFactory.Updated()) == 'BOX_UPDATED'
예제 #2
0
    def test_render_event_name__wrong_finalizer(self):

        # -- Success Executed of Created
        try:
            assert Create('Car').render_event_name(Mock(),
                                                   EventFactory.Executed())

        except EventFactory.BrokenRequest as e:
            assert e.event == (
                'INVALID_FINALIZER_USED_FOR_SPECIFIC_COMMAND_DETECTED')

        # -- Updated instead of Deleted
        try:
            assert Delete('Car').render_event_name(Mock(),
                                                   EventFactory.Updated())

        except EventFactory.BrokenRequest as e:
            assert e.event == (
                'INVALID_FINALIZER_USED_FOR_SPECIFIC_COMMAND_DETECTED')