|
| 1 | +# FIXME: these are remnants of the legacy edge proxy. these tests should somehow be migrated to |
| 2 | +# instead either test the LocalstackAwsGateway (integration), or functionality of the http server (unit). |
1 | 3 | import io |
2 | 4 | import json |
3 | 5 | import os |
4 | | -import urllib |
5 | 6 |
|
6 | 7 | import pytest |
7 | 8 | import requests |
8 | 9 | import xmltodict |
9 | | -from quart import request as quart_request |
10 | 10 | from requests.models import Request as RequestsRequest |
11 | 11 |
|
12 | 12 | from localstack import config |
13 | 13 | from localstack.aws.accounts import get_aws_account_id |
14 | 14 | from localstack.constants import APPLICATION_JSON, HEADER_LOCALSTACK_EDGE_URL |
15 | | -from localstack.http.request import get_full_raw_path |
16 | 15 | from localstack.services.generic_proxy import ( |
17 | 16 | MessageModifyingProxyListener, |
18 | 17 | ProxyListener, |
@@ -53,9 +52,7 @@ def test_invoke_s3(self): |
53 | 52 | edge_url = config.get_edge_url() |
54 | 53 | self._invoke_s3_via_edge(edge_url) |
55 | 54 |
|
56 | | - @pytest.mark.xfail( |
57 | | - condition=not config.LEGACY_EDGE_PROXY, reason="failing with new HTTP gateway (only in CI)" |
58 | | - ) |
| 55 | + @pytest.mark.xfail(reason="failing in CI") # TODO verify this |
59 | 56 | def test_invoke_s3_multipart_request(self): |
60 | 57 | edge_url = config.get_edge_url() |
61 | 58 | self._invoke_s3_via_edge_multipart_form(edge_url) |
@@ -361,28 +358,3 @@ def test_request_with_custom_host_header(self): |
361 | 358 | response = requests.get(f"{url}/2015-03-31/functions", headers=headers) |
362 | 359 | assert response |
363 | 360 | assert "Functions" in json.loads(to_str(response.content)) |
364 | | - |
365 | | - @pytest.mark.skipif( |
366 | | - condition=not config.LEGACY_EDGE_PROXY, reason="only relevant for old edge proxy" |
367 | | - ) |
368 | | - def test_forward_raw_path(self, monkeypatch): |
369 | | - class MyListener(ProxyListener): |
370 | | - def forward_request(self, method, path, data, headers): |
371 | | - _path = get_full_raw_path(quart_request) |
372 | | - return {"method": method, "path": _path} |
373 | | - |
374 | | - # start listener and configure EDGE_FORWARD_URL |
375 | | - port = get_free_tcp_port() |
376 | | - forward_url = f"http://localhost:{port}" |
377 | | - listener = MyListener() |
378 | | - proxy = start_proxy_server(port, update_listener=listener, use_ssl=True) |
379 | | - monkeypatch.setattr(config, "EDGE_FORWARD_URL", forward_url) |
380 | | - |
381 | | - # run test request, assert that raw request path is forwarded |
382 | | - test_arn = "arn:aws:test:resource/test" |
383 | | - raw_path = f"/test/{urllib.parse.quote(test_arn)}/bar?q1=foo&q2=bar" |
384 | | - url = f"{config.get_edge_url()}{raw_path}" |
385 | | - response = requests.get(url) |
386 | | - expected = {"method": "GET", "path": raw_path} |
387 | | - assert json.loads(to_str(response.content)) == expected |
388 | | - proxy.stop() |
0 commit comments