We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd97d44 commit 4132334Copy full SHA for 4132334
openlibrary/tests/core/test_lending.py
@@ -1,6 +1,7 @@
1
from unittest.mock import Mock, patch
2
3
from openlibrary.core import lending
4
+from openlibrary.utils.async_utils import user_agent, x_forwarded_for
5
6
7
class TestAddAvailability:
@@ -42,6 +43,10 @@ def mock_get_availability(id_type, ocaids):
42
43
44
class TestGetAvailability:
45
def test_cache(self):
46
+ # Set needed context variables
47
+ x_forwarded_for.set("ol-internal")
48
+ user_agent.set("test-user-agent")
49
+
50
with patch("openlibrary.core.ia.session.get") as mock_get:
51
mock_get.return_value = Mock()
52
mock_get.return_value.json.return_value = {
0 commit comments