Best Python code snippet using localstack_python
test_edge.py
Source:test_edge.py  
...130        client.download_fileobj(bucket_name, object_name, result)131        assert to_str(result.getvalue()) == to_str(object_data)132        client.delete_object(Bucket=bucket_name, Key=object_name)133        client.delete_bucket(Bucket=bucket_name)134    def test_basic_https_invocation(self):135        class MyListener(ProxyListener):136            def forward_request(self, method, path, data, headers):137                return {"method": method, "path": path, "data": data}138        port = get_free_tcp_port()139        url = f"https://localhost:{port}/foo/bar"140        listener = MyListener()141        proxy = start_proxy_server(port, update_listener=listener, use_ssl=True)142        response = requests.post(url, verify=False)143        expected = {"method": "POST", "path": "/foo/bar", "data": ""}144        assert json.loads(to_str(response.content)) == expected145        proxy.stop()146    def test_http2_relay_traffic(self):147        """Tests if HTTP2 traffic can correctly be forwarded (including url-encoded characters)."""148        # Create a simple HTTP echo server...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
