Date: Saturday, May 6, 2023 @ 09:21:16
  Author: yan12125
Revision: 1458957

upgpkg: python-moto 4.1.8-1; backport patches for Werkzeug 2.3

See: https://github.com/getmoto/moto/pull/6266
See: https://github.com/getmoto/moto/pull/6257
See: https://github.com/getmoto/moto/issues/6288

Added:
  python-moto/trunk/werkzeug-2.3.diff
Modified:
  python-moto/trunk/PKGBUILD

-------------------+
 PKGBUILD          |   13 ++++++++++---
 werkzeug-2.3.diff |   41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-05-06 09:05:38 UTC (rev 1458956)
+++ PKGBUILD    2023-05-06 09:21:16 UTC (rev 1458957)
@@ -45,13 +45,20 @@
                python-graphql-core python-jsondiff python-aws-xray-sdk
                python-cfn-lint python-sshpubkeys python-pyparsing 
python-py-partiql-parser
                python-flask python-flask-cors)
-source=("https://files.pythonhosted.org/packages/source/m/moto/moto-${pkgver}.tar.gz";)
-sha256sums=('c3ecc2dda1a7b3a3c46655490bc6a4660b7bb47e31eaed7bbd54adeb01f8471f')
+source=("https://files.pythonhosted.org/packages/source/m/moto/moto-${pkgver}.tar.gz";
+        "fix-tests.diff"
+        "werkzeug-2.3.diff")
+sha256sums=('c3ecc2dda1a7b3a3c46655490bc6a4660b7bb47e31eaed7bbd54adeb01f8471f'
+            '21305cdf3d650ced1acb1d0f7dde8760b26e32a94c56a5571e798d6b6976cf5a'
+            '34bb8c75e67799c1c09c4996ef89476e6b93ad8b79f4fd294019c12249b02357')
 
 prepare() {
   cd $_pkgname-$pkgver
 
   patch -Np1 -i ../fix-tests.diff
+  # A combined patch from https://github.com/getmoto/moto/pull/6266 and 
https://github.com/getmoto/moto/pull/6257
+  # Both are merged to git-master
+  patch -Np1 -i ../werkzeug-2.3.diff
 }
 
 build() {
@@ -63,7 +70,7 @@
 check() {
   cd $_pkgname-$pkgver
 
-  PYTHONDONTWRITEBYTECODE=1 TZ=UTC pytest tests -m 'not requires_docker'
+  TZ=UTC pytest tests -m 'not requires_docker'
 }
 
 package() {

Added: werkzeug-2.3.diff
===================================================================
--- werkzeug-2.3.diff                           (rev 0)
+++ werkzeug-2.3.diff   2023-05-06 09:21:16 UTC (rev 1458957)
@@ -0,0 +1,41 @@
+diff --git a/moto/moto_server/werkzeug_app.py 
b/moto/moto_server/werkzeug_app.py
+index 14f85517..234a74d4 100644
+--- a/moto/moto_server/werkzeug_app.py
++++ b/moto/moto_server/werkzeug_app.py
+@@ -201,7 +201,7 @@ class DomainDispatcherApplication:
+         finally:
+             if body:
+                 # We've consumed the body = need to reset it
+-                environ["wsgi.input"] = io.StringIO(body)
++                environ["wsgi.input"] = io.BytesIO(body.encode("utf-8"))
+         return body
+ 
+     def get_service_from_body(
+diff --git a/tests/test_moto_api/recorder/__init__.py 
b/tests/test_moto_api/recorder/__init__.py
+new file mode 100644
+index 00000000..e69de29b
+diff --git a/tests/test_moto_api/recorder/test_recorder.py 
b/tests/test_moto_api/recorder/test_recorder.py
+index f716b3d6..5eef5919 100644
+--- a/tests/test_moto_api/recorder/test_recorder.py
++++ b/tests/test_moto_api/recorder/test_recorder.py
+@@ -1,3 +1,4 @@
++import base64
+ import boto3
+ import json
+ import requests
+@@ -81,8 +82,13 @@ class TestRecorder(TestCase):
+ 
+         content = json.loads(self._download_recording())
+ 
+-        content.should.have.key("body").should.contain("Action=RunInstances")
+-        
content.should.have.key("body").should.contain(f"ImageId={EXAMPLE_AMI_ID}")
++        if content.get("body_encoded"):
++            body = base64.b64decode(content.get("body")).decode("ascii")
++        else:
++            body = content["body"]
++
++        body.should.contain("Action=RunInstances")
++        body.should.contain(f"ImageId={EXAMPLE_AMI_ID}")
+ 
+     def test_multiple_services(self):
+         self._start_recording()

Reply via email to