test: fixed currency exchange test for frankfurter v2 api

(cherry picked from commit 138f683a68)
This commit is contained in:
diptanilsaha
2026-06-09 23:00:41 +05:30
committed by Mergify
parent 471ab662f6
commit 6f25d915c7

View File

@@ -66,13 +66,16 @@ def patched_requests_get(*args, **kwargs):
if kwargs["params"].get("date") and kwargs["params"].get("from") and kwargs["params"].get("to"):
if test_exchange_values.get(kwargs["params"]["date"]):
return PatchResponse({"result": test_exchange_values[kwargs["params"]["date"]]}, 200)
elif args[0].startswith("https://api.frankfurter.dev") and kwargs.get("params"):
elif args[0].startswith("https://api.frankfurter.dev/v1") and kwargs.get("params"):
if kwargs["params"].get("base") and kwargs["params"].get("symbols"):
date = args[0].replace("https://api.frankfurter.dev/v1/", "")
if test_exchange_values.get(date):
return PatchResponse(
{"rates": {kwargs["params"].get("symbols"): test_exchange_values.get(date)}}, 200
)
elif args[0].startswith("https://api.frankfurter.dev/v2") and kwargs.get("params"):
if kwargs["params"].get("date") and test_exchange_values.get(kwargs["params"]["date"]):
return PatchResponse({"rate": test_exchange_values.get(kwargs["params"]["date"])}, 200)
return PatchResponse({"rates": None}, 404)