Ejemplo n.º 1
0
def test_hook_inject():
    """PyTest fixture temporarily disabling default hooks and installing
    HookInjecter."""
    orig_hooks = pydov.hooks

    pydov.hooks = Hooks((HookInjecter(), ))
    yield

    pydov.hooks = orig_hooks
Ejemplo n.º 2
0
    def test_default_hooks(self, nocache):
        """Test the default hooks by performing a simple search.

        Test whether no exceptions are raised.

        Parameters
        ----------
        nocache : pytest.fixture
            Fixture temporarily disabling caching.

        """
        pydov.hooks = Hooks((SimpleStatusHook(), ))

        query = PropertyIsEqualTo(propertyname='boornummer',
                                  literal='GEO-04/169-BNo-B1')

        boringsearch = BoringSearch()
        boringsearch.search(query=query)
Ejemplo n.º 3
0
# -*- coding: utf-8 -*-
import requests

import pydov.util.caching
from pydov.util.hooks import (
    SimpleStatusHook,
    Hooks,
)

__author__ = """DOV-Vlaanderen"""
__version__ = '1.0.0'

cache = pydov.util.caching.GzipTextFileCache()

hooks = Hooks(
    (SimpleStatusHook(),)
)

# Package wide requests session object. This increases performance as using a
# session object allows connection pooling and TCP connection reuse.
request_timeout = 300
session = requests.Session()
session.headers.update({'user-agent': 'pydov/{}'.format(pydov.__version__)})