# Path: modernrpc/exceptions.py
# RPC_METHOD_NOT_FOUND = -32601
# 
# RPC_INVALID_PARAMS = -32602
# 
# RPC_INTERNAL_ERROR = -32603
# 
# RPC_INVALID_REQUEST = -32600
# 
# RPC_PARSE_ERROR = -32700
# 
# RPC_CUSTOM_ERROR_BASE = -32099


import json
import random
import re
import xml.etree.cElementTree as ET
import pytest
import requests
from json import JSONDecodeError
from django.core.serializers.json import DjangoJSONEncoder
from modernrpc.exceptions import (
    RPC_METHOD_NOT_FOUND,
    RPC_INVALID_PARAMS,
    RPC_INTERNAL_ERROR,
    RPC_INVALID_REQUEST,
    RPC_PARSE_ERROR,
    RPC_CUSTOM_ERROR_BASE,
)

        headers = {"content-type": jsonrpc_content_type}
        payload = {
            # "method": 'add',
            "params": [5, 6],
            "jsonrpc": "2.0",
            "id": random.randint(1, 1000),
        }
        response = self.low_level_jsonrpc_call(
            live_server.url + endpoint_path, payload, headers=headers
        )

        assert 'Missing parameter "method"' in response["error"]["message"]
        assert RPC_INVALID_REQUEST == response["error"]["code"]

    def test_missing_version(self, live_server, endpoint_path, jsonrpc_content_type):
        # Missing 'jsonrpc' in payload

        headers = {"content-type": jsonrpc_content_type}
        payload = {
            "method": "add",
            "params": [5, 6],
            # "jsonrpc": "2.0",
            "id": random.randint(1, 1000),
        }
        response = self.low_level_jsonrpc_call(
            live_server.url + endpoint_path, payload, headers=headers
        )

        assert 'Missing parameter "jsonrpc"' in response["error"]["message"]

# Path: modernrpc/exceptions.py
# RPC_METHOD_NOT_FOUND = -32601
# 
# RPC_INVALID_PARAMS = -32602
# 
# RPC_INTERNAL_ERROR = -32603
# 
# RPC_INVALID_REQUEST = -32600
# 
# RPC_PARSE_ERROR = -32700
# 
# RPC_CUSTOM_ERROR_BASE = -32099


# Path: tests/functional/test_errors.py
import json
import random
import re
import xml.etree.cElementTree as ET
import pytest
import requests
from json import JSONDecodeError
from django.core.serializers.json import DjangoJSONEncoder
from modernrpc.exceptions import (
    RPC_METHOD_NOT_FOUND,
    RPC_INVALID_PARAMS,
    RPC_INTERNAL_ERROR,
    RPC_INVALID_REQUEST,
    RPC_PARSE_ERROR,
    RPC_CUSTOM_ERROR_BASE,
)


        headers = {"content-type": jsonrpc_content_type}
        payload = {
            # "method": 'add',
            "params": [5, 6],
            "jsonrpc": "2.0",
            "id": random.randint(1, 1000),
        }
        response = self.low_level_jsonrpc_call(
            live_server.url + endpoint_path, payload, headers=headers
        )

        assert 'Missing parameter "method"' in response["error"]["message"]
        assert RPC_INVALID_REQUEST == response["error"]["code"]

    def test_missing_version(self, live_server, endpoint_path, jsonrpc_content_type):
        # Missing 'jsonrpc' in payload

        headers = {"content-type": jsonrpc_content_type}
        payload = {
            "method": "add",
            "params": [5, 6],
            # "jsonrpc": "2.0",
            "id": random.randint(1, 1000),
        }
        response = self.low_level_jsonrpc_call(
            live_server.url + endpoint_path, payload, headers=headers
        )

        assert 'Missing parameter "jsonrpc"' in response["error"]["message"]

        assert RPC_INVALID_REQUEST == response["error"]["code"]