Skip to content

Commit be9ccfc

Browse files
committed
Refactor some tests.
1 parent b006305 commit be9ccfc

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

instrumentation/opentelemetry-instrumentation-aiohttp-server/tests/test_aiohttp_server_integration.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
import pytest
1616
import pytest_asyncio
1717
import aiohttp
18-
from http import HTTPMethod, HTTPStatus
18+
from http import HTTPStatus
19+
from .utils import HTTPMethod
1920
from pkg_resources import iter_entry_points
2021
from unittest import mock
2122

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This was adapted from Python 3.11 http module.
2+
from enum import Enum
3+
4+
5+
class HTTPMethod(Enum):
6+
"""HTTP methods and descriptions
7+
8+
Methods from the following RFCs are all observed:
9+
10+
* RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616
11+
* RFC 5789: PATCH Method for HTTP
12+
"""
13+
14+
def __repr__(self):
15+
return self.value[0]
16+
17+
CONNECT = 'CONNECT', 'Establish a connection to the server.'
18+
DELETE = 'DELETE', 'Remove the target.'
19+
GET = 'GET', 'Retrieve the target.'
20+
HEAD = 'HEAD', 'Same as GET, but only retrieve the status line and header section.'
21+
OPTIONS = 'OPTIONS', 'Describe the communication options for the target.'
22+
PATCH = 'PATCH', 'Apply partial modifications to a target.'
23+
POST = 'POST', 'Perform target-specific processing with the request payload.'
24+
PUT = 'PUT', 'Replace the target with the request payload.'
25+
TRACE = 'TRACE', 'Perform a message loop-back test along the path to the target.'

0 commit comments

Comments
 (0)