fleet-python 0.2.69b3__py3-none-any.whl → 0.2.70__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fleet-python might be problematic. Click here for more details.
- fleet/__init__.py +3 -2
- fleet/_async/__init__.py +26 -2
- fleet/_async/base.py +21 -10
- fleet/_async/client.py +131 -201
- fleet/_async/env/client.py +38 -7
- fleet/_async/instance/client.py +4 -19
- fleet/_async/resources/sqlite.py +1 -150
- fleet/_async/tasks.py +13 -7
- fleet/_async/verifiers/bundler.py +22 -21
- fleet/_async/verifiers/verifier.py +20 -19
- fleet/base.py +21 -10
- fleet/client.py +137 -219
- fleet/config.py +1 -1
- fleet/env/__init__.py +8 -0
- fleet/env/client.py +38 -7
- fleet/instance/client.py +5 -20
- fleet/models.py +33 -0
- fleet/resources/sqlite.py +1 -143
- fleet/tasks.py +15 -7
- fleet/verifiers/bundler.py +22 -21
- fleet/verifiers/decorator.py +1 -1
- fleet/verifiers/verifier.py +20 -19
- {fleet_python-0.2.69b3.dist-info → fleet_python-0.2.70.dist-info}/METADATA +1 -1
- {fleet_python-0.2.69b3.dist-info → fleet_python-0.2.70.dist-info}/RECORD +27 -31
- tests/test_app_method.py +0 -85
- tests/test_instance_dispatch.py +0 -607
- tests/test_sqlite_resource_dual_mode.py +0 -263
- tests/test_sqlite_shared_memory_behavior.py +0 -117
- {fleet_python-0.2.69b3.dist-info → fleet_python-0.2.70.dist-info}/WHEEL +0 -0
- {fleet_python-0.2.69b3.dist-info → fleet_python-0.2.70.dist-info}/licenses/LICENSE +0 -0
- {fleet_python-0.2.69b3.dist-info → fleet_python-0.2.70.dist-info}/top_level.txt +0 -0
fleet/verifiers/verifier.py
CHANGED
|
@@ -90,9 +90,9 @@ class SyncVerifierFunction:
|
|
|
90
90
|
|
|
91
91
|
self._bundle_data = zip_buffer.getvalue()
|
|
92
92
|
self._bundle_sha = _get_bundle_sha(self._bundle_data)
|
|
93
|
-
logger.debug(
|
|
94
|
-
|
|
95
|
-
)
|
|
93
|
+
# logger.debug(
|
|
94
|
+
# f"Created bundle from raw code for {self.key} with SHA: {self._bundle_sha}"
|
|
95
|
+
# )
|
|
96
96
|
else:
|
|
97
97
|
# Try to create bundle from function source
|
|
98
98
|
try:
|
|
@@ -100,9 +100,9 @@ class SyncVerifierFunction:
|
|
|
100
100
|
self.func, self.extra_requirements, self.verifier_id
|
|
101
101
|
)
|
|
102
102
|
self._bundle_sha = _get_bundle_sha(self._bundle_data)
|
|
103
|
-
logger.debug(
|
|
104
|
-
|
|
105
|
-
)
|
|
103
|
+
# logger.debug(
|
|
104
|
+
# f"Created bundle for {self.key} with SHA: {self._bundle_sha}"
|
|
105
|
+
# )
|
|
106
106
|
except OSError as e:
|
|
107
107
|
# Can't create bundle - no source and no raw code
|
|
108
108
|
raise OSError(f"Cannot create bundle for {self.key}: {e}")
|
|
@@ -115,20 +115,21 @@ class SyncVerifierFunction:
|
|
|
115
115
|
|
|
116
116
|
# If bundle_data is empty, we're using server-side bundle
|
|
117
117
|
if not bundle_data:
|
|
118
|
-
logger.debug(f"Using server-side bundle {bundle_sha[:8]}...")
|
|
118
|
+
# logger.debug(f"Using server-side bundle {bundle_sha[:8]}...")
|
|
119
119
|
return bundle_sha, False # No upload needed, server has it
|
|
120
120
|
|
|
121
121
|
# Always check if bundle exists on server
|
|
122
122
|
try:
|
|
123
123
|
exists = env.check_bundle_exists(bundle_sha)
|
|
124
124
|
if exists.success:
|
|
125
|
-
logger.info(f"Bundle {bundle_sha[:8]}... found on server")
|
|
125
|
+
# logger.info(f"Bundle {bundle_sha[:8]}... found on server")
|
|
126
126
|
return bundle_sha, False # Found on server, no upload needed
|
|
127
127
|
except Exception as e:
|
|
128
|
-
logger.warning(f"Failed to check bundle existence: {e}")
|
|
128
|
+
# logger.warning(f"Failed to check bundle existence: {e}")
|
|
129
|
+
pass
|
|
129
130
|
|
|
130
131
|
# Bundle not found on server - upload needed
|
|
131
|
-
logger.info(f"Bundle {bundle_sha[:8]}... needs to be uploaded")
|
|
132
|
+
# logger.info(f"Bundle {bundle_sha[:8]}... needs to be uploaded")
|
|
132
133
|
return bundle_sha, True # Upload needed
|
|
133
134
|
|
|
134
135
|
def __call__(self, env: "SyncEnv", *args, **kwargs) -> float:
|
|
@@ -158,7 +159,7 @@ class SyncVerifierFunction:
|
|
|
158
159
|
)
|
|
159
160
|
|
|
160
161
|
except Exception as e:
|
|
161
|
-
logger.error(f"Error in verifier {self.key}: {e}")
|
|
162
|
+
# logger.error(f"Error in verifier {self.key}: {e}")
|
|
162
163
|
# Return error score 0
|
|
163
164
|
return 0.0
|
|
164
165
|
|
|
@@ -190,7 +191,7 @@ class SyncVerifierFunction:
|
|
|
190
191
|
try:
|
|
191
192
|
return float(result)
|
|
192
193
|
except (ValueError, TypeError):
|
|
193
|
-
logger.warning(f"Could not convert result to float: {result}")
|
|
194
|
+
# logger.warning(f"Could not convert result to float: {result}")
|
|
194
195
|
return 0.0
|
|
195
196
|
|
|
196
197
|
def _raise_remote_error(self, error_info: Dict[str, Any]):
|
|
@@ -249,7 +250,7 @@ Remote traceback:
|
|
|
249
250
|
|
|
250
251
|
if needs_upload:
|
|
251
252
|
# Need to upload bundle to S3
|
|
252
|
-
logger.info(f"Uploading bundle {bundle_sha[:8]}... for {self.key}")
|
|
253
|
+
# logger.info(f"Uploading bundle {bundle_sha[:8]}... for {self.key}")
|
|
253
254
|
bundle_data, _ = self._get_or_create_bundle()
|
|
254
255
|
|
|
255
256
|
response = env.execute_verifier_remote(
|
|
@@ -263,12 +264,12 @@ Remote traceback:
|
|
|
263
264
|
needs_upload=True,
|
|
264
265
|
)
|
|
265
266
|
|
|
266
|
-
logger.debug(f"Bundle {bundle_sha[:8]}... uploaded successfully")
|
|
267
|
+
# logger.debug(f"Bundle {bundle_sha[:8]}... uploaded successfully")
|
|
267
268
|
return response
|
|
268
269
|
|
|
269
270
|
else:
|
|
270
271
|
# Bundle already available - execute without upload
|
|
271
|
-
logger.info(f"Bundle {bundle_sha[:8]}... already cached for {self.key}")
|
|
272
|
+
# logger.info(f"Bundle {bundle_sha[:8]}... already cached for {self.key}")
|
|
272
273
|
response = env.execute_verifier_remote(
|
|
273
274
|
bundle_data=b"", # Empty bundle since it's cached
|
|
274
275
|
bundle_sha=bundle_sha,
|
|
@@ -284,9 +285,9 @@ Remote traceback:
|
|
|
284
285
|
except Exception as e:
|
|
285
286
|
# Check if error indicates bundle not found and retry with upload
|
|
286
287
|
if self._is_bundle_not_found_error(e) and not needs_upload:
|
|
287
|
-
logger.info(
|
|
288
|
-
|
|
289
|
-
)
|
|
288
|
+
# logger.info(
|
|
289
|
+
# f"Bundle {bundle_sha[:8]}... not found on server, uploading..."
|
|
290
|
+
# )
|
|
290
291
|
bundle_data, _ = self._get_or_create_bundle()
|
|
291
292
|
response = env.execute_verifier_remote(
|
|
292
293
|
bundle_data=bundle_data,
|
|
@@ -300,7 +301,7 @@ Remote traceback:
|
|
|
300
301
|
)
|
|
301
302
|
return response
|
|
302
303
|
else:
|
|
303
|
-
logger.error(f"Error in remote execution of {self.key}: {e}")
|
|
304
|
+
# logger.error(f"Error in remote execution of {self.key}: {e}")
|
|
304
305
|
raise
|
|
305
306
|
|
|
306
307
|
|
|
@@ -21,64 +21,60 @@ examples/openai_simple_example.py,sha256=HmiufucrAZne7tHq9uoEsDWlEhjNC265bQAyIGB
|
|
|
21
21
|
examples/query_builder_example.py,sha256=-cOMfWGNifYfYEt_Ds73XpwATZvFDL6F4KTkVxdMjzg,3951
|
|
22
22
|
examples/quickstart.py,sha256=1VT39IRRhemsJgxi0O0gprdpcw7HB4pYO97GAYagIcg,3788
|
|
23
23
|
examples/test_cdp_logging.py,sha256=AkCwQCgOTQEI8w3v0knWK_4eXMph7L9x07wj9yIYM10,2836
|
|
24
|
-
fleet/__init__.py,sha256=
|
|
25
|
-
fleet/base.py,sha256=
|
|
26
|
-
fleet/client.py,sha256=
|
|
27
|
-
fleet/config.py,sha256=
|
|
24
|
+
fleet/__init__.py,sha256=TumoqC49tWQWtj2B2GiHgxgSfnj1xwkLlldkVIo1i14,4218
|
|
25
|
+
fleet/base.py,sha256=KX25a60_SOquqrj81vBK3men3cG0_nmiAuEh2t3Y94I,9501
|
|
26
|
+
fleet/client.py,sha256=PR3TiLEDadect1EKwpJCU_WArH3Kpjh8n90oMxAXPaM,37160
|
|
27
|
+
fleet/config.py,sha256=n_wh9Sahu3gGE7nHJ7kqNFUH1qDiBtF4bgZq9MvIBMU,319
|
|
28
28
|
fleet/exceptions.py,sha256=fUmPwWhnT8SR97lYsRq0kLHQHKtSh2eJS0VQ2caSzEI,5055
|
|
29
29
|
fleet/global_client.py,sha256=frrDAFNM2ywN0JHLtlm9qbE1dQpnQJsavJpb7xSR_bU,1072
|
|
30
|
-
fleet/models.py,sha256=
|
|
31
|
-
fleet/tasks.py,sha256=
|
|
30
|
+
fleet/models.py,sha256=7ZRUVBT0_6tiJkotWLTj52oVaeDfP4OsjjkWJxhf8CA,15409
|
|
31
|
+
fleet/tasks.py,sha256=jee0RqbIGzqbtYmTUtGWtVbgiiomy6ywfH-DJrF4nSo,18363
|
|
32
32
|
fleet/types.py,sha256=L4Y82xICf1tzyCLqhLYUgEoaIIS5h9T05TyFNHSWs3s,652
|
|
33
|
-
fleet/_async/__init__.py,sha256=
|
|
34
|
-
fleet/_async/base.py,sha256=
|
|
35
|
-
fleet/_async/client.py,sha256=
|
|
33
|
+
fleet/_async/__init__.py,sha256=0vIHueFbjbmRiSBtM9B_8Sjox8pOUL-ce66wdp1TpZs,9101
|
|
34
|
+
fleet/_async/base.py,sha256=NdUNxAeToYeRD5fRRKT9bzqLv1IBqNUQvDFilKmfCY8,9522
|
|
35
|
+
fleet/_async/client.py,sha256=LWJYR-e7wyChKABVTD0jHF-MzCnh6Tb43VzQKMytZe0,37723
|
|
36
36
|
fleet/_async/exceptions.py,sha256=fUmPwWhnT8SR97lYsRq0kLHQHKtSh2eJS0VQ2caSzEI,5055
|
|
37
37
|
fleet/_async/global_client.py,sha256=4WskpLHbsDEgWW7hXMD09W-brkp4euy8w2ZJ88594rQ,1103
|
|
38
38
|
fleet/_async/models.py,sha256=-3xv2QyoHsvYcWmdKLf9Z93md8XB17DBeJCxdRCB3bo,13571
|
|
39
|
-
fleet/_async/tasks.py,sha256=
|
|
39
|
+
fleet/_async/tasks.py,sha256=stYJay2f261-ekRfOQo9RVGndbL09M_QjjFar71BYwk,18387
|
|
40
40
|
fleet/_async/env/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
|
-
fleet/_async/env/client.py,sha256=
|
|
41
|
+
fleet/_async/env/client.py,sha256=FqetvDlABeHLaAc8UF_m_2OFEhXy4ZqH7ly_Nh8p3uA,3479
|
|
42
42
|
fleet/_async/instance/__init__.py,sha256=PtmJq8J8bh0SOQ2V55QURz5GJfobozwtQoqhaOk3_tI,515
|
|
43
43
|
fleet/_async/instance/base.py,sha256=3qUBuUR8OVS36LzdP6KyZzngtwPKYO09HoY6Ekxp-KA,1625
|
|
44
|
-
fleet/_async/instance/client.py,sha256=
|
|
44
|
+
fleet/_async/instance/client.py,sha256=kcrmLZciQxvPSfTtbEq5LIbhscwDHg6WIiNcPyM4L9w,6085
|
|
45
45
|
fleet/_async/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
46
|
fleet/_async/resources/base.py,sha256=UfrenxUqcpL8SgYGOo8o8HgRvv2-ZO5G2Cdo91ofEdg,664
|
|
47
47
|
fleet/_async/resources/browser.py,sha256=oldoSiymJ1lJkADhpUG81ViOBDNyppX1jSoEwe9-W94,1369
|
|
48
48
|
fleet/_async/resources/mcp.py,sha256=TLEsLiFhfVfZFs0Fu_uDPm-h4FPdvqgQblYqs-PTHhc,1720
|
|
49
|
-
fleet/_async/resources/sqlite.py,sha256=
|
|
49
|
+
fleet/_async/resources/sqlite.py,sha256=up_umepfyX9PDFsnmEMJLjsj7bLa6a3wizZOgMGkK1Q,27409
|
|
50
50
|
fleet/_async/verifiers/__init__.py,sha256=1WTlCNq4tIFbbXaQu5Bf2WppZq0A8suhtZbxMTSOwxI,465
|
|
51
|
-
fleet/_async/verifiers/bundler.py,sha256=
|
|
52
|
-
fleet/_async/verifiers/verifier.py,sha256=
|
|
53
|
-
fleet/env/__init__.py,sha256=
|
|
54
|
-
fleet/env/client.py,sha256=
|
|
51
|
+
fleet/_async/verifiers/bundler.py,sha256=9aWWXFsovBPcndE06IATn5jaeli5fRORAYeenF9heN0,26264
|
|
52
|
+
fleet/_async/verifiers/verifier.py,sha256=Zvok2Mog09l885StW429Rg_8_4bd-gaYUGIgpILeb_I,14207
|
|
53
|
+
fleet/env/__init__.py,sha256=BVPZ4AYTznL6AYNrVmjr1yLF16qBcT1U56jWwF7AJ5o,964
|
|
54
|
+
fleet/env/client.py,sha256=N9oF2hGSNmfVacTnyQhIEocoN3BA5fMa-arbpVeNi-E,3221
|
|
55
55
|
fleet/instance/__init__.py,sha256=CyWUkbGAK-DBPw4DC4AnCW-MqqheGhZMA5QSRVu-ws4,479
|
|
56
56
|
fleet/instance/base.py,sha256=OYqzBwZFfTX9wlBGSG5gljqj98NbiJeKIfFJ3uj5I4s,1587
|
|
57
|
-
fleet/instance/client.py,sha256=
|
|
57
|
+
fleet/instance/client.py,sha256=XM_Qmd7pUzC3-dCMTh6orTEsGeWJXbKueBlvcWcSUuI,5897
|
|
58
58
|
fleet/instance/models.py,sha256=ZTiue0YOuhuwX8jYfJAoCzGfqjLqqXRLqK1LVFhq6rQ,4183
|
|
59
59
|
fleet/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
60
60
|
fleet/resources/base.py,sha256=AXZzT0_yWHkT497q3yekfr0xsD4cPGMCC6y7C43TIkk,663
|
|
61
61
|
fleet/resources/browser.py,sha256=hRNM0YMsVQUAraZGNi_B-KXxLpuddy4ntoEDFSw7czU,1295
|
|
62
62
|
fleet/resources/mcp.py,sha256=c6O4vVJnXANuHMGMe4IPxgp4zBEbFaGm6_d9e6j8Myc,1695
|
|
63
|
-
fleet/resources/sqlite.py,sha256=
|
|
63
|
+
fleet/resources/sqlite.py,sha256=bR6d1zYQ4cMAlmZIJ7jqmY9-N-GokXaDhUyGKTWHsfY,26811
|
|
64
64
|
fleet/verifiers/__init__.py,sha256=GntS8qc3xv8mm-cku1t3xjvOll5jcc5FuiVqQgR4Y6Q,458
|
|
65
|
-
fleet/verifiers/bundler.py,sha256=
|
|
65
|
+
fleet/verifiers/bundler.py,sha256=9aWWXFsovBPcndE06IATn5jaeli5fRORAYeenF9heN0,26264
|
|
66
66
|
fleet/verifiers/code.py,sha256=A1i_UabZspbyj1awzKVQ_HRxgMO3fU7NbkxYyTrp7So,48
|
|
67
67
|
fleet/verifiers/db.py,sha256=LAh1HambBInH_D9q9E2Z41YNkCOI9JJfpWPFqztjpfQ,27922
|
|
68
|
-
fleet/verifiers/decorator.py,sha256=
|
|
68
|
+
fleet/verifiers/decorator.py,sha256=RuTjjDijbicNfMSjA7HcTpKueEki5dzNOdTuHS7UoZs,3262
|
|
69
69
|
fleet/verifiers/parse.py,sha256=qz9AfJrTbjlg-LU-lE8Ciqi7Yt2a8-cs17FdpjTLhMk,8550
|
|
70
70
|
fleet/verifiers/sql_differ.py,sha256=TqTLWyK3uOyLbitT6HYzYEzuSFC39wcyhgk3rcm__k8,6525
|
|
71
|
-
fleet/verifiers/verifier.py,sha256=
|
|
72
|
-
fleet_python-0.2.
|
|
71
|
+
fleet/verifiers/verifier.py,sha256=npnTBB-A1Cl66gNOGPR6UaybvcDy6C6_hWchyIJeDyc,14252
|
|
72
|
+
fleet_python-0.2.70.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
73
73
|
scripts/fix_sync_imports.py,sha256=X9fWLTpiPGkSHsjyQUDepOJkxOqw1DPj7nd8wFlFqLQ,8368
|
|
74
74
|
scripts/unasync.py,sha256=vWVQxRWX8SRZO5cmzEhpvnG_REhCWXpidIGIpWmEcvI,696
|
|
75
75
|
tests/__init__.py,sha256=Re1SdyxH8NfyL1kjhi7SQkGP1mYeWB-D6UALqdIMd8I,35
|
|
76
|
-
tests/test_app_method.py,sha256=kg2IiL75cH-HmsTMS3_wDL39dAesgfv_AT6jVthd5J4,3159
|
|
77
|
-
tests/test_instance_dispatch.py,sha256=CvU4C3LBIqsYZdEsEFfontGjyxAZfVYyXnGwxyIvXOc,23065
|
|
78
|
-
tests/test_sqlite_resource_dual_mode.py,sha256=Mh8jBd-xsIGDYFsOACKKK_5DXMUYlFFS7W-jaY6AjG4,8734
|
|
79
|
-
tests/test_sqlite_shared_memory_behavior.py,sha256=fKx_1BmLS3b8x-9pMgjMycpnaHWY8P-2ZuXEspx6Sbw,4082
|
|
80
76
|
tests/test_verifier_from_string.py,sha256=Lxi3TpFHFb-hG4-UhLKZJkqo84ax9YJY8G6beO-1erM,13581
|
|
81
|
-
fleet_python-0.2.
|
|
82
|
-
fleet_python-0.2.
|
|
83
|
-
fleet_python-0.2.
|
|
84
|
-
fleet_python-0.2.
|
|
77
|
+
fleet_python-0.2.70.dist-info/METADATA,sha256=j26JuOscnwPwiQyc4ICc_0mbInNctVnhk9WA8AecOB0,3304
|
|
78
|
+
fleet_python-0.2.70.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
79
|
+
fleet_python-0.2.70.dist-info/top_level.txt,sha256=qb1zIbtEktyhRFZdqVytwg54l64qtoZL0wjHB4bUg3c,29
|
|
80
|
+
fleet_python-0.2.70.dist-info/RECORD,,
|
tests/test_app_method.py
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"""Unit tests for SyncEnv.app() method URL handling."""
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
from unittest.mock import Mock, patch
|
|
5
|
-
from fleet.client import Fleet
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TestAppMethod:
|
|
9
|
-
"""Test SyncEnv.app() method with different URL formats."""
|
|
10
|
-
|
|
11
|
-
@pytest.fixture
|
|
12
|
-
def fleet_client(self):
|
|
13
|
-
"""Create a Fleet client with mocked HTTP client."""
|
|
14
|
-
with patch("fleet.client.default_httpx_client") as mock_client:
|
|
15
|
-
mock_client.return_value = Mock()
|
|
16
|
-
client = Fleet(api_key="test_key")
|
|
17
|
-
client.client.request = Mock()
|
|
18
|
-
return client
|
|
19
|
-
|
|
20
|
-
def test_app_with_existing_app_path(self, fleet_client):
|
|
21
|
-
"""Test app() with URL that already has an app path like /sentry."""
|
|
22
|
-
# Create instance with a URL that has an existing app path
|
|
23
|
-
env = fleet_client.instance("https://example.com/sentry/api/v1/env")
|
|
24
|
-
|
|
25
|
-
# Access jira app
|
|
26
|
-
jira_client = env.app("jira")
|
|
27
|
-
|
|
28
|
-
# Check the constructed URL
|
|
29
|
-
assert jira_client.base_url == "https://example.com/jira/api/v1/env", \
|
|
30
|
-
f"Expected https://example.com/jira/api/v1/env, got {jira_client.base_url}"
|
|
31
|
-
|
|
32
|
-
def test_app_without_app_path(self, fleet_client):
|
|
33
|
-
"""Test app() with URL that has no app path (just /api/v1/env)."""
|
|
34
|
-
# Create instance with a URL without an app path
|
|
35
|
-
env = fleet_client.instance("https://example.com/api/v1/env")
|
|
36
|
-
|
|
37
|
-
# Access jira app
|
|
38
|
-
jira_client = env.app("jira")
|
|
39
|
-
|
|
40
|
-
# Check the constructed URL
|
|
41
|
-
assert jira_client.base_url == "https://example.com/jira/api/v1/env", \
|
|
42
|
-
f"Expected https://example.com/jira/api/v1/env, got {jira_client.base_url}"
|
|
43
|
-
|
|
44
|
-
def test_app_with_different_app_names(self, fleet_client):
|
|
45
|
-
"""Test app() with multiple different app names."""
|
|
46
|
-
env = fleet_client.instance("https://example.com/api/v1/env")
|
|
47
|
-
|
|
48
|
-
jira = env.app("jira")
|
|
49
|
-
sentry = env.app("sentry")
|
|
50
|
-
github = env.app("github")
|
|
51
|
-
|
|
52
|
-
assert jira.base_url == "https://example.com/jira/api/v1/env"
|
|
53
|
-
assert sentry.base_url == "https://example.com/sentry/api/v1/env"
|
|
54
|
-
assert github.base_url == "https://example.com/github/api/v1/env"
|
|
55
|
-
|
|
56
|
-
def test_app_caching(self, fleet_client):
|
|
57
|
-
"""Test that app() caches InstanceClient instances."""
|
|
58
|
-
env = fleet_client.instance("https://example.com/api/v1/env")
|
|
59
|
-
|
|
60
|
-
# Call app("jira") twice
|
|
61
|
-
jira1 = env.app("jira")
|
|
62
|
-
jira2 = env.app("jira")
|
|
63
|
-
|
|
64
|
-
# Should return the same cached instance
|
|
65
|
-
assert jira1 is jira2
|
|
66
|
-
|
|
67
|
-
def test_app_with_localhost(self, fleet_client):
|
|
68
|
-
"""Test app() with localhost URLs."""
|
|
69
|
-
env = fleet_client.instance("http://localhost:8080/api/v1/env")
|
|
70
|
-
|
|
71
|
-
jira = env.app("jira")
|
|
72
|
-
|
|
73
|
-
assert jira.base_url == "http://localhost:8080/jira/api/v1/env"
|
|
74
|
-
|
|
75
|
-
def test_app_with_port(self, fleet_client):
|
|
76
|
-
"""Test app() with URLs that include port numbers."""
|
|
77
|
-
env = fleet_client.instance("https://example.com:9000/api/v1/env")
|
|
78
|
-
|
|
79
|
-
jira = env.app("jira")
|
|
80
|
-
|
|
81
|
-
assert jira.base_url == "https://example.com:9000/jira/api/v1/env"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if __name__ == "__main__":
|
|
85
|
-
pytest.main([__file__, "-v"])
|