fix: no message on bare curl
This commit is contained in:
+25
-11
@@ -136,6 +136,8 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
) -> RequestHandler:
|
||||
if headers is None:
|
||||
headers = {}
|
||||
if "Accept" not in headers:
|
||||
headers["Accept"] = "nothing"
|
||||
with self.patch("http.server.BaseHTTPRequestHandler.__init__"):
|
||||
handler = RequestHandler(
|
||||
unittest.mock.MagicMock(),
|
||||
@@ -433,8 +435,9 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
self.mock_call_unchecked(self.data_dir.extract_tar_bytes),
|
||||
self.mock_call(self.registry.add, ["path"]),
|
||||
self.mock_call(self.token_manager.set_token, ["path", "secret"]),
|
||||
self.mock_call(self.registry.get_from_path, ["path"]),
|
||||
self.expects_status_only(
|
||||
handler, http.HTTPStatus.CREATED, "Resource /path/ updated"
|
||||
handler, http.HTTPStatus.CREATED, "Resource updated"
|
||||
),
|
||||
self.seal_mocks(),
|
||||
):
|
||||
@@ -458,8 +461,9 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
self.mock_call(self.registry.add, ["path"]),
|
||||
self.mock_call(self.token_manager.set_token, ["path", "secret"]),
|
||||
self.mock_call(self.registry.set_host, ["path", "example.com"]),
|
||||
self.mock_call(self.registry.get_from_path, ["path"]),
|
||||
self.expects_status_only(
|
||||
handler, http.HTTPStatus.CREATED, "Resource /path/ updated"
|
||||
handler, http.HTTPStatus.CREATED, "Resource updated"
|
||||
),
|
||||
self.seal_mocks(),
|
||||
):
|
||||
@@ -481,8 +485,9 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
self.mock_call(self.registry.add, ["path"]),
|
||||
self.mock_call(self.token_manager.set_token, ["path", "secret"]),
|
||||
self.mock_call(self.registry.set_spa, ["path", "index.html"]),
|
||||
self.mock_call(self.registry.get_from_path, ["path"]),
|
||||
self.expects_status_only(
|
||||
handler, http.HTTPStatus.CREATED, "Resource /path/ updated"
|
||||
handler, http.HTTPStatus.CREATED, "Resource updated"
|
||||
),
|
||||
self.seal_mocks(),
|
||||
):
|
||||
@@ -530,8 +535,9 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
),
|
||||
self.mock_call(self.registry.set_redirect, ["path", "https://example.com"]),
|
||||
self.mock_call(self.token_manager.set_token, ["path", "secret"]),
|
||||
self.mock_call(self.registry.get_from_path, ["path"]),
|
||||
self.expects_status_only(
|
||||
handler, http.HTTPStatus.CREATED, "Resource /path/ updated"
|
||||
handler, http.HTTPStatus.CREATED, "Resource updated"
|
||||
),
|
||||
self.seal_mocks(),
|
||||
):
|
||||
@@ -557,8 +563,9 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
self.mock_call(self.registry.set_redirect, ["path", "https://example.com"]),
|
||||
self.mock_call(self.token_manager.set_token, ["path", "secret"]),
|
||||
self.mock_call(self.registry.set_host, ["path", "example.com"]),
|
||||
self.mock_call(self.registry.get_from_path, ["path"]),
|
||||
self.expects_status_only(
|
||||
handler, http.HTTPStatus.CREATED, "Resource /path/ updated"
|
||||
handler, http.HTTPStatus.CREATED, "Resource updated"
|
||||
),
|
||||
self.seal_mocks(),
|
||||
):
|
||||
@@ -584,8 +591,9 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
self.mock_call(self.registry.set_redirect, ["path", "https://example.com"]),
|
||||
self.mock_call(self.token_manager.set_token, ["path", "secret"]),
|
||||
self.mock_call(self.registry.set_host_only, ["path", "example.com"]),
|
||||
self.mock_call(self.registry.get_from_path, ["path"]),
|
||||
self.expects_status_only(
|
||||
handler, http.HTTPStatus.CREATED, "Resource /path/ updated"
|
||||
handler, http.HTTPStatus.CREATED, "Resource updated"
|
||||
),
|
||||
self.seal_mocks(),
|
||||
):
|
||||
@@ -633,8 +641,9 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
),
|
||||
self.mock_call(self.registry.set_proxy, ["path", "https://example.com"]),
|
||||
self.mock_call(self.token_manager.set_token, ["path", "secret"]),
|
||||
self.mock_call(self.registry.get_from_path, ["path"]),
|
||||
self.expects_status_only(
|
||||
handler, http.HTTPStatus.CREATED, "Resource /path/ updated"
|
||||
handler, http.HTTPStatus.CREATED, "Resource updated"
|
||||
),
|
||||
self.seal_mocks(),
|
||||
):
|
||||
@@ -660,8 +669,9 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
self.mock_call(self.registry.set_proxy, ["path", "https://example.com"]),
|
||||
self.mock_call(self.token_manager.set_token, ["path", "secret"]),
|
||||
self.mock_call(self.registry.set_host, ["path", "example.com"]),
|
||||
self.mock_call(self.registry.get_from_path, ["path"]),
|
||||
self.expects_status_only(
|
||||
handler, http.HTTPStatus.CREATED, "Resource /path/ updated"
|
||||
handler, http.HTTPStatus.CREATED, "Resource updated"
|
||||
),
|
||||
self.seal_mocks(),
|
||||
):
|
||||
@@ -783,9 +793,7 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
self.mock_call(self.data_dir.exists, ["path"], True), # noqa: FBT003
|
||||
self.mock_call(self.data_dir.remove, ["path"]),
|
||||
self.mock_call(self.registry.remove, ["path"]),
|
||||
self.expects_error(
|
||||
handler, http.HTTPStatus.NO_CONTENT, "Resource /path/ removed"
|
||||
),
|
||||
self.expects_error(handler, http.HTTPStatus.OK, "Resource /path/ removed"),
|
||||
self.seal_mocks(),
|
||||
):
|
||||
handler.do_DELETE()
|
||||
@@ -813,6 +821,7 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
"data": None,
|
||||
"headers": {
|
||||
"Host": "example.com",
|
||||
"Accept": "nothing",
|
||||
"X-Real-IP": "127.0.0.1",
|
||||
"X-Forwarded-Host": "localhost",
|
||||
"X-Forwarded-For": "127.0.0.1",
|
||||
@@ -855,6 +864,7 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
"data": b"hello",
|
||||
"headers": {
|
||||
"Host": "example.com",
|
||||
"Accept": "nothing",
|
||||
"X-Real-IP": "127.0.0.1",
|
||||
"X-Forwarded-Host": "localhost",
|
||||
"X-Forwarded-For": "127.0.0.1",
|
||||
@@ -897,6 +907,7 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
"data": None,
|
||||
"headers": {
|
||||
"Host": "example.com",
|
||||
"Accept": "nothing",
|
||||
"X-Real-IP": "127.0.0.1",
|
||||
"X-Forwarded-Host": "localhost",
|
||||
"X-Forwarded-For": "127.0.0.1",
|
||||
@@ -930,6 +941,7 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
"data": None,
|
||||
"headers": {
|
||||
"Host": "example.com",
|
||||
"Accept": "nothing",
|
||||
"X-Real-IP": "127.0.0.1",
|
||||
"X-Forwarded-Host": "localhost",
|
||||
"X-Forwarded-For": "127.0.0.1",
|
||||
@@ -972,6 +984,7 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
"data": None,
|
||||
"headers": {
|
||||
"Host": "example.com",
|
||||
"Accept": "nothing",
|
||||
"X-Real-IP": "127.0.0.1",
|
||||
"X-Forwarded-Host": "localhost",
|
||||
"X-Forwarded-For": "127.0.0.1",
|
||||
@@ -1011,6 +1024,7 @@ class TestRequestHandler(BaseHandlerTestCase):
|
||||
"data": None,
|
||||
"headers": {
|
||||
"Host": "example.com",
|
||||
"Accept": "nothing",
|
||||
"X-Real-IP": "127.0.0.1",
|
||||
"X-Forwarded-Host": "host",
|
||||
"X-Forwarded-For": "127.0.0.1",
|
||||
|
||||
Reference in New Issue
Block a user