|
1 | 1 | import pytest |
2 | | -from pinecone import Pinecone, PodSpec, ServerlessSpec |
| 2 | +import re |
| 3 | +from pinecone import ConfigBuilder, Pinecone, PodSpec, ServerlessSpec |
3 | 4 | from pinecone.core.client.models import IndexList, IndexModel |
4 | 5 | from pinecone.core.client.api.manage_indexes_api import ManageIndexesApi |
5 | 6 | from pinecone.core.client.configuration import Configuration as OpenApiConfiguration |
@@ -41,6 +42,15 @@ def test_overwrite_useragent(self): |
41 | 42 | assert p.index_api.api_client.default_headers['User-Agent'] == 'test-user-agent' |
42 | 43 | assert len(p.index_api.api_client.default_headers) == 1 |
43 | 44 |
|
| 45 | + def test_set_source_tag_in_useragent(self): |
| 46 | + p = Pinecone(api_key="123-456-789", source_tag="test_source_tag") |
| 47 | + assert re.search(r"source_tag=test_source_tag", p.index_api.api_client.user_agent) is not None |
| 48 | + |
| 49 | + def test_set_source_tag_in_useragent_via_config(self): |
| 50 | + config = ConfigBuilder.build(api_key='YOUR_API_KEY', host='https://my-host', source_tag='my_source_tag') |
| 51 | + p = Pinecone(config=config) |
| 52 | + assert re.search(r"source_tag=my_source_tag", p.index_api.api_client.user_agent) is not None |
| 53 | + |
44 | 54 | @pytest.mark.parametrize("timeout_value, describe_index_responses, expected_describe_index_calls, expected_sleep_calls", [ |
45 | 55 | # When timeout=None, describe_index is called until ready |
46 | 56 | (None, [{ "status": {"ready": False}}, {"status": {"ready": True}}], 2, 1), |
|
0 commit comments