Ver código fonte

use the same error structure in apple endpoints

Son NK 4 anos atrás
pai
commit
f4f2db0f04
2 arquivos alterados com 4 adições e 4 exclusões
  1. 2 2
      app/api/views/apple.py
  2. 2 2
      tests/api/test_apple.py

+ 2 - 2
app/api/views/apple.py

@@ -51,7 +51,7 @@ def apple_process_payment():
     if apple_sub:
         return jsonify(ok=True), 200
 
-    return jsonify(ok=False), 400
+    return jsonify(error="Processing failed"), 400
 
 
 @api_bp.route("/apple/update_notification", methods=["GET", "POST"])
@@ -287,7 +287,7 @@ def apple_update_notification():
                 original_transaction_id,
             )
             LOG.d("request data %s", data)
-            return jsonify(ok=False), 400
+            return jsonify(error="Processing failed"), 400
 
 
 def verify_receipt(receipt_data, user, password) -> Optional[AppleSubscription]:

+ 2 - 2
tests/api/test_apple.py

@@ -24,7 +24,7 @@ def test_apple_process_payment(flask_client):
 
     # will fail anyway as there's apple secret is not valid
     assert r.status_code == 400
-    assert r.json == {"ok": False}
+    assert r.json == {"error": "Processing failed"}
 
 
 def test_apple_update_notification(flask_client):
@@ -213,4 +213,4 @@ def test_apple_update_notification(flask_client):
 
     # will fail anyway as there's no such AppleSub in Test DB
     assert r.status_code == 400
-    assert r.json == {"ok": False}
+    assert r.json == {"error": "Processing failed"}