Skip to content

Commit d9c9c4b

Browse files
restore proper coverage
1 parent c64c9ca commit d9c9c4b

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

tests/test_client_v2.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,18 @@ def json(self):
2828

2929
monkeypatch.setenv("MINDEE_V2_BASE_URL", "https://dummy-url")
3030

31-
def _fake_post(*args, **kwargs):
31+
def _fake_response(*args, **kwargs):
3232
return _FakeResp()
3333

3434
monkeypatch.setattr(
3535
"mindee.mindee_http.mindee_api_v2.requests.post",
36-
_fake_post,
36+
_fake_response,
37+
raising=True,
38+
)
39+
40+
monkeypatch.setattr(
41+
"mindee.mindee_http.mindee_api_v2.requests.get",
42+
_fake_response,
3743
raising=True,
3844
)
3945

@@ -47,9 +53,10 @@ def test_parse_path_without_token():
4753

4854

4955
@pytest.mark.v2
50-
def test_parse_path_with_env_token(custom_base_url_client):
56+
def test_enqueue_path_with_env_token(custom_base_url_client):
5157
assert custom_base_url_client.mindee_api.base_url == "https://dummy-url"
5258
assert custom_base_url_client.mindee_api.url_root == "https://dummy-url"
59+
assert custom_base_url_client.mindee_api.api_key == "dummy"
5360
input_doc: LocalInputSource = custom_base_url_client.source_from_path(
5461
f"{FILE_TYPES_DIR}/receipt.jpg"
5562
)
@@ -59,6 +66,23 @@ def test_parse_path_with_env_token(custom_base_url_client):
5966
)
6067

6168

69+
@pytest.mark.v2
70+
def test_enqueue_and_parse_path_with_env_token(custom_base_url_client):
71+
input_doc: LocalInputSource = custom_base_url_client.source_from_path(
72+
f"{FILE_TYPES_DIR}/receipt.jpg"
73+
)
74+
with pytest.raises(MindeeHTTPErrorV2):
75+
custom_base_url_client.enqueue_and_parse(
76+
input_doc, InferencePredictOptions("dummy-model")
77+
)
78+
79+
80+
@pytest.mark.v2
81+
def test_parse_queued6_and_parse_path_with_env_token(custom_base_url_client):
82+
with pytest.raises(MindeeHTTPErrorV2):
83+
custom_base_url_client.parse_queued("dummy-queue")
84+
85+
6286
@pytest.mark.v2
6387
def test_loads_from_prediction(env_client):
6488
input_inference = LocalResponse(

0 commit comments

Comments
 (0)