Beispiel #1
0
    def test_create_empty__defaults(self):

        e = EventFactory.BaseSuccessException()

        assert e.data == {}
        assert e.context == EventFactory.Context()
        assert e.event is None
        assert e.instance is None
Beispiel #2
0
    def test_extend(self):

        context = Mock()
        e = EventFactory.BaseSuccessException()
        prev_context = e.context

        e.extend(event='HI', context=context)

        assert e.event == 'HI'
        assert e.context == context
        assert e.context != prev_context
Beispiel #3
0
    def test_log__no_user_id_in_context(self):

        dumps = self.mocker.patch('lily.base.events.orjson.dumps')
        dumps.return_value = '{XX}'
        logger = Mock()
        e = EventFactory.BaseSuccessException(
            context=EventFactory.Context(), event='HELLO')
        logger = self.mocker.patch.object(e, 'logger')

        e.log()

        assert logger.info.call_args_list == [call('HELLO: {XX}')]
        assert dumps.call_args_list == [call({'@event': 'HELLO'}, option=4)]