Skip to content

Commit 4132334

Browse files
committed
fix lending test
1 parent bd97d44 commit 4132334

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

openlibrary/tests/core/test_lending.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from unittest.mock import Mock, patch
22

33
from openlibrary.core import lending
4+
from openlibrary.utils.async_utils import user_agent, x_forwarded_for
45

56

67
class TestAddAvailability:
@@ -42,6 +43,10 @@ def mock_get_availability(id_type, ocaids):
4243

4344
class TestGetAvailability:
4445
def test_cache(self):
46+
# Set needed context variables
47+
x_forwarded_for.set("ol-internal")
48+
user_agent.set("test-user-agent")
49+
4550
with patch("openlibrary.core.ia.session.get") as mock_get:
4651
mock_get.return_value = Mock()
4752
mock_get.return_value.json.return_value = {

0 commit comments

Comments
 (0)