From 08d4fa82784b71dd73ddcff6f7f67ef19d2b531d Mon Sep 17 00:00:00 2001 From: Henil Panchal Date: Tue, 23 Jan 2024 23:36:42 +0530 Subject: [PATCH] fix: jwt tests --- backend/packages.py | 5 ++++- backend/tests/test_packages.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/packages.py b/backend/packages.py index ff03eb49..960165b0 100644 --- a/backend/packages.py +++ b/backend/packages.py @@ -11,6 +11,7 @@ import os import toml import shutil +import json from flasgger.utils import swag_from from urllib.parse import unquote import math @@ -589,7 +590,9 @@ def get_package_from_version(namespace_name, package_name, version): return jsonify({"message": "Package not found", "code": 404}), 404 else: - package_obj = Package.from_json(package) + return jsonify({"message": f"Package not found {type(json.dumps(package))}", "code": 404,}), 404 + package_obj = Package.from_json(json.dumps(package)) + return jsonify({"message": f"Package not found {package}", "code": 404,}), 404 # Get the package author from id. package_author = db.users.find_one({"_id": package_obj.author}) diff --git a/backend/tests/test_packages.py b/backend/tests/test_packages.py index 9ead3135..35ee39e1 100644 --- a/backend/tests/test_packages.py +++ b/backend/tests/test_packages.py @@ -320,6 +320,7 @@ def test_get_existing_package_version(self): response = self.client.get( f"/packages/{self.test_namespace_data['namespace']}/{self.test_package_data['package_name']}/0.0.1" ) + print(response.json["message"]) self.assertEqual(200, response.json["code"]) print("test_get_existing_package_version passed")