api.system.components.runtime.v1.host.cachedconfigurations.test_helpers.host_cachedconfigurations_clear.list_persistent_components — Argus-Toolbelt 1.0 documentation

# Source code for api.system.components.runtime.v1.host.cachedconfigurations.test_helpers.host_cachedconfigurations_clear.list_persistent_components

    def success(function):
        """Mock https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/host/\w+/persistence, respond with HTTP 200"""
        import requests_mock
        from argus_api.helpers.tests import fake_response
        def mock_response(*args, **kwargs):
            with requests_mock.Mocker(real_http=True) as mock:
                mock.register_uri(
                    "GET",
                    r"https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/host/\w+/persistence",
                    status_code=200,
                    json=fake_response({})
                )
                return function(*args, **kwargs)
            return mock_response
        return decorator

    def unauthorized(function):
        """Mock https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/host/\w+/persistence, respond with HTTP 401"""
        import requests_mock
        from argus_api.helpers.tests import fake_response
        def mock_response(*args, **kwargs):
            with requests_mock.Mocker(real_http=True) as mock:
                mock.register_uri(
                    "GET",
                    r"https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/host/\w+/persistence",
                    status_code=401,
                    json=None
                )
                return function(*args, **kwargs)
            return mock_response
        return decorator

    def forbidden(function):
        """Mock https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/host/\w+/persistence, respond with HTTP 403"""
        import requests_mock
        from argus_api.helpers.tests import fake_response
        def mock_response(*args, **kwargs):
            with requests_mock.Mocker(real_http=True) as mock:
                mock.register_uri(
                    "GET",
                    r"https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/host/\w+/persistence",
                    status_code=403,
                    json=None
                )
                return function(*args, **kwargs)
            return mock_response
        return decorator

    def not_found(function):
        """Mock https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/host/\w+/persistence, respond with HTTP 404"""
        import requests_mock
        from argus_api.helpers.tests import fake_response
        def mock_response(*args, **kwargs):
            with requests_mock.Mocker(real_http=True) as mock:
                mock.register_uri(
                    "GET",
                    r"https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/host/\w+/persistence",
                    status_code=404,
                    json=None
                )
                return function(*args, **kwargs)
            return mock_response
        return decorator