@@ -28,12 +28,18 @@ def json(self):
28
28
29
29
monkeypatch .setenv ("MINDEE_V2_BASE_URL" , "https://dummy-url" )
30
30
31
- def _fake_post (* args , ** kwargs ):
31
+ def _fake_response (* args , ** kwargs ):
32
32
return _FakeResp ()
33
33
34
34
monkeypatch .setattr (
35
35
"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 ,
37
43
raising = True ,
38
44
)
39
45
@@ -47,9 +53,10 @@ def test_parse_path_without_token():
47
53
48
54
49
55
@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 ):
51
57
assert custom_base_url_client .mindee_api .base_url == "https://dummy-url"
52
58
assert custom_base_url_client .mindee_api .url_root == "https://dummy-url"
59
+ assert custom_base_url_client .mindee_api .api_key == "dummy"
53
60
input_doc : LocalInputSource = custom_base_url_client .source_from_path (
54
61
f"{ FILE_TYPES_DIR } /receipt.jpg"
55
62
)
@@ -59,6 +66,23 @@ def test_parse_path_with_env_token(custom_base_url_client):
59
66
)
60
67
61
68
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
+
62
86
@pytest .mark .v2
63
87
def test_loads_from_prediction (env_client ):
64
88
input_inference = LocalResponse (
0 commit comments