api.cases.v1.test_helpers.case.list_cases — Argus-Toolbelt 1.0 documentation

# Source code for api.cases.v1.test_helpers.case.list_cases

    def success(function):
        """Mock https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v1/case, 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/cases/v1/case",
                    status_code=200,
                    json=fake_response({'offset': {'type': 'int', 'name': 'offset'}, 'limit': {'type': 'int', 'name': 'limit'}, 'responseCode': {'type': 'int', 'name': 'responseCode'}, 'count': {'type': 'int', 'name': 'count'}, 'data': {'type': 'list', 'items': {'description': {'type': 'str'}, 'tags': {'type': 'list', 'uniqueItems': True, 'items': {'type': 'str', 'value': {'type': 'str'}}}, 'properties': {'type': 'dict', 'additionalProperties': {'type': 'str'}}, 'flags': {'type': 'int'}, 'userACL': {'type': 'list', 'uniqueItems': True, 'items': {'type': 'int'}}, 'createdByUser': {'id': {'type': 'int'}, 'customerID': {'type': 'int'}, 'domain': {'$ref': '#/definitions/DomainInfo'}, 'userName': {'type': 'str'}, 'name': {'type': 'str'}, 'type': 'str', 'options': ['user', 'group']}, 'serviceType': {'id': {'type': 'int'}, 'name': {'type': 'str'}, 'flags': {'type': 'int'}, 'description': {'type': 'str'}, 'logoURL': {'type': 'str'}, 'notificationEmail': {'type': 'str'}, 'techFunction': {'$ref': '#/definitions/FunctionInfo'}, 'text': {'type': 'str'}, 'accessFunction': {'$ref': '#/definitions/FunctionInfo'}}, 'customer': {'id': {'type': 'int'}, 'name': {'type': 'str'}, 'shortName': {'type': 'str'}, 'domain': {'$ref': '#/definitions/DomainInfo'}}, 'status': {'type': 'str', 'enum': ['ATTACHMENT_ADDED', 'PENDING_CUSTOMER', 'PENDING_SOC', 'PENDING_VENDOR', 'WORKING_SOC', 'WORKING_CUSTOMER', 'PENDING_CLOSE', 'CLOSED']}, 'logType': {'type': 'str', 'enum': ['SECURITY_INCIDENT', 'CHANGE', 'OPERATIONAL_INCIDENT', 'INFORMATIONAL']}, 'customerReference': {'type': 'str'}, 'priority': {'type': 'int'}, 'contacts': {'type': 'list', 'items': {'id': {'type': 'int'}, 'languageID': {'type': 'int'}, 'name': {'type': 'str'}, 'value': {'type': 'str'}, 'type': 'str', 'flags': {'type': 'int'}, 'subjectID': {'type': 'int'}, 'verbose': {'type': 'bool', 'default': False}, 'language': {'type': 'str', 'enum': ['ENGLISH', 'NORWEGIAN']}, 'default': {'type': 'bool', 'default': False}, 'options': ['EMAIL', 'SMS', 'PHONE']}}, 'category': {'id': {'type': 'int'}, 'description': {'type': 'str'}, 'localeText': {'type': 'str'}, 'logType': {'type': 'str', 'enum': ['SECURITY_INCIDENT', 'CHANGE', 'OPERATIONAL_INCIDENT', 'INFORMATIONAL']}, 'serviceTypeID': {'type': 'int'}, 'flags': {'type': 'int'}}, 'id': {'type': 'int'}, 'createdTimestamp': {'type': 'int'}, 'lastUpdatedTimestamp': {'type': 'int'}, 'publishedTimestamp': {'type': 'int'}}, 'name': 'data'}, 'metaData': {'type': 'dict', 'additionalProperties': {'type': 'dict'}, 'name': 'metaData'}, 'messages': {'type': 'list', 'items': {'message': {'type': 'str'}, 'messageTemplate': {'type': 'str'}, 'type': 'str', 'field': {'type': 'str'}, 'parameter': {'type': 'dict'}, 'timestamp': {'type': 'int'}, 'options': ['FIELD_ERROR', 'ACTION_ERROR', 'WARNING', 'NOTIFICATION', 'INFO']}, 'name': 'messages'}, 'currentPage': {'type': 'int', 'name': 'currentPage'}, 'size': {'type': 'int', 'name': 'size'}})
                )
                return function(*args, **kwargs)
            return mock_response
        return decorator

    def unauthorized(function):
        """Mock https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v1/case, 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/cases/v1/case",
                    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/cases/v1/case, 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/cases/v1/case",
                    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/cases/v1/case, 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/cases/v1/case",
                    status_code=404,
                    json=None
                )
                return function(*args, **kwargs)
            return mock_response
        return decorator