Skip to content

Commit 7e10290

Browse files
authored
Fix duplicate test names preventing test runs. (#134)
* Fix duplicate test_http_request preventing test runs. * Remove duplicate http response headers test.
1 parent f20dbda commit 7e10290

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

tests/test_http.py

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import base64
2-
import urllib.parse
3-
import json
42
import gzip
3+
import json
4+
import urllib.parse
55

66
import pytest
77
from starlette.applications import Starlette
88
from starlette.middleware.gzip import GZipMiddleware
99
from starlette.responses import PlainTextResponse
10+
1011
from mangum import Mangum
1112

1213

@@ -115,7 +116,7 @@ async def app(scope, receive, send):
115116
"raw_path": None,
116117
"root_path": "",
117118
"scheme": "https",
118-
"server": ("test.execute-api.us-west-2.amazonaws.com", 80),
119+
"server": ("test.execute-api.us-west-2.amazonaws.com", 443),
119120
"type": "http",
120121
}
121122
await send(
@@ -545,7 +546,7 @@ async def app(scope, receive, send):
545546
],
546547
indirect=["mock_http_api_event"],
547548
)
548-
def test_http_request(mock_http_api_event) -> None:
549+
def test_api_request(mock_http_api_event) -> None:
549550
async def app(scope, receive, send):
550551
assert scope == {
551552
"asgi": {"version": "3.0"},
@@ -632,32 +633,6 @@ async def app(scope, receive, send):
632633
}
633634

634635

635-
@pytest.mark.parametrize("mock_http_event", [["GET", "", None]], indirect=True)
636-
def test_http_response_headers(mock_http_event) -> None:
637-
async def app(scope, receive, send):
638-
assert scope["type"] == "http"
639-
await send(
640-
{
641-
"type": "http.response.start",
642-
"status": 200,
643-
"headers": [[b"x-header-1", b"123"], [b"x-header-2", b"456"]],
644-
}
645-
)
646-
await send({"type": "http.response.body", "body": b"Hello, world!"})
647-
648-
handler = Mangum(app, lifespan="off")
649-
650-
mock_http_event["headers"] = None
651-
652-
response = handler(mock_http_event, {})
653-
assert response == {
654-
"statusCode": 200,
655-
"isBase64Encoded": False,
656-
"headers": {"x-header-1": "123", "x-header-2": "456"},
657-
"body": "Hello, world!",
658-
}
659-
660-
661636
@pytest.mark.parametrize("mock_http_event", [["GET", "", None]], indirect=True)
662637
def test_http_empty_header(mock_http_event) -> None:
663638
async def app(scope, receive, send):

0 commit comments

Comments
 (0)