mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-19 01:18:43 +00:00
test: fixed currency exchange test for frankfurter v2 api
(cherry picked from commit 138f683a68)
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user