From f4f2db0f04a314afd87c3088a941232354e30d0d Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Tue, 3 Nov 2020 16:13:10 +0100 Subject: [PATCH] use the same error structure in apple endpoints --- app/api/views/apple.py | 4 ++-- tests/api/test_apple.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/views/apple.py b/app/api/views/apple.py index 948ea9fb..bcc8acfc 100644 --- a/app/api/views/apple.py +++ b/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]: diff --git a/tests/api/test_apple.py b/tests/api/test_apple.py index bef31a56..9259423c 100644 --- a/tests/api/test_apple.py +++ b/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"}