Esempio n. 1
0
def _request_context(secure=True):
    import os
    import mock
    from werkzeug.test import create_environ
    from cmk.gui.utils.script_helpers import request_context
    if secure:
        protocol = 'https'
    else:
        protocol = 'http'
    with mock.patch.dict(os.environ, {'OMD_SITE': 'NO_SITE'}), \
            request_context(create_environ(base_url=f"{protocol}://localhost:5000/")):
        yield
Esempio n. 2
0
def _request_context(secure=True):
    import os
    import mock
    from werkzeug.test import create_environ
    from cmk.gui.utils.script_helpers import request_context
    if secure:
        protocol = 'https'
    else:
        protocol = 'http'
    # Previous tests already set the site to "heute", which makes this test fail.
    version.omd_site.cache_clear()
    with mock.patch.dict(os.environ, {'OMD_SITE': 'NO_SITE'}), \
            request_context(create_environ(base_url=f"{protocol}://localhost:5000/")):
        yield