Best Python code snippet using localstack_python
test_parsers.py
Source:test_parsers.py
...75 }), None)),76 ],77 ),78])79def test_multipart_parsing(fixture, expected):80 with open(f"tests/fixtures/{fixture}", "rb") as f:81 boundary = f.readline().decode()82 data = f.read().replace(b"\n", b"\r\n")83 # These tests use a small bufsize in addition to a FlakyStream in84 # order to attempt to catch boundary parsing errors.85 parser = MultiPartParser(bufsize=128)86 content_type = f"multipart/form-data; boundary={boundary}"87 content_length = len(data)88 stream = FlakyStream(BytesIO(data))89 if isinstance(expected, Exception):90 with pytest.raises(type(expected)) as e_data:91 parser.parse(content_type, content_length, stream)92 assert e_data.value.message == expected.message93 return...
test_request.py
Source:test_request.py
...104 if k.lower().startswith("x-amz-meta"):105 assert k == "X-Amz-Meta--FOO_BaR-ed"106 return107 pytest.fail(f"key not in header keys {keys}")108def test_multipart_parsing():109 body = (110 b"--4efd159eae0c4f4e125a5a509e073d85"111 b"\r\n"112 b'Content-Disposition: form-data; name="foo"; filename="foo"'113 b"\r\n\r\n"114 b"bar"115 b"\r\n"116 b"--4efd159eae0c4f4e125a5a509e073d85"117 b"\r\n"118 b'Content-Disposition: form-data; name="baz"; filename="baz"'119 b"\r\n\r\n"120 b"ed"121 b"\r\n--4efd159eae0c4f4e125a5a509e073d85--"122 b"\r\n"...
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!!