Ejemplo n.º 1
0
    def test_create_user_func_key(self, send_bus_event, UserCreateFuncKeyEvent):
        new_event = UserCreateFuncKeyEvent.return_value = Mock()

        func_key = UserFuncKey(id=1, user_id=2)

        notifier.created(func_key)

        UserCreateFuncKeyEvent.assert_called_once_with(func_key.id,
                                                       func_key.user_id)

        send_bus_event.assert_called_once_with(new_event, new_event.routing_key)
Ejemplo n.º 2
0
    def test_create_bsfilter_func_key(self, send_bus_event, BSFilterCreateFuncKeyEvent):
        new_event = BSFilterCreateFuncKeyEvent.return_value = Mock()

        func_key = BSFilterFuncKey(id=1, filter_id=2, secretary_id=3)

        notifier.created(func_key)

        BSFilterCreateFuncKeyEvent.assert_called_once_with(func_key.id,
                                                           func_key.filter_id,
                                                           func_key.secretary_id)

        send_bus_event.assert_called_once_with(new_event, new_event.routing_key)
Ejemplo n.º 3
0
def create_user_destination(user):
    func_key = UserFuncKey(user_id=user.id)
    created_func_key = dao.create(func_key)
    notifier.created(created_func_key)
    return created_func_key