@@ -721,12 +721,22 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str
721721 @mock .patch ("zeroentropy._base_client.BaseClient._calculate_retry_timeout" , _low_retry_timeout )
722722 @pytest .mark .respx (base_url = base_url )
723723 def test_retrying_timeout_errors_doesnt_leak (self , respx_mock : MockRouter ) -> None :
724- respx_mock .post ("/status/get-status " ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
724+ respx_mock .post ("/documents/add-document " ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
725725
726726 with pytest .raises (APITimeoutError ):
727727 self .client .post (
728- "/status/get-status" ,
729- body = cast (object , dict ()),
728+ "/documents/add-document" ,
729+ body = cast (
730+ object ,
731+ dict (
732+ collection_name = "example_collection" ,
733+ content = {
734+ "type" : "text" ,
735+ "text" : "Example Content" ,
736+ },
737+ path = "my_document.txt" ,
738+ ),
739+ ),
730740 cast_to = httpx .Response ,
731741 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
732742 )
@@ -736,12 +746,22 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
736746 @mock .patch ("zeroentropy._base_client.BaseClient._calculate_retry_timeout" , _low_retry_timeout )
737747 @pytest .mark .respx (base_url = base_url )
738748 def test_retrying_status_errors_doesnt_leak (self , respx_mock : MockRouter ) -> None :
739- respx_mock .post ("/status/get-status " ).mock (return_value = httpx .Response (500 ))
749+ respx_mock .post ("/documents/add-document " ).mock (return_value = httpx .Response (500 ))
740750
741751 with pytest .raises (APIStatusError ):
742752 self .client .post (
743- "/status/get-status" ,
744- body = cast (object , dict ()),
753+ "/documents/add-document" ,
754+ body = cast (
755+ object ,
756+ dict (
757+ collection_name = "example_collection" ,
758+ content = {
759+ "type" : "text" ,
760+ "text" : "Example Content" ,
761+ },
762+ path = "my_document.txt" ,
763+ ),
764+ ),
745765 cast_to = httpx .Response ,
746766 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
747767 )
@@ -772,9 +792,16 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
772792 return httpx .Response (500 )
773793 return httpx .Response (200 )
774794
775- respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
795+ respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
776796
777- response = client .status .with_raw_response .get_status ()
797+ response = client .documents .with_raw_response .add (
798+ collection_name = "collection_name" ,
799+ content = {
800+ "text" : "text" ,
801+ "type" : "text" ,
802+ },
803+ path = "path" ,
804+ )
778805
779806 assert response .retries_taken == failures_before_success
780807 assert int (response .http_request .headers .get ("x-stainless-retry-count" )) == failures_before_success
@@ -796,9 +823,17 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
796823 return httpx .Response (500 )
797824 return httpx .Response (200 )
798825
799- respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
826+ respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
800827
801- response = client .status .with_raw_response .get_status (extra_headers = {"x-stainless-retry-count" : Omit ()})
828+ response = client .documents .with_raw_response .add (
829+ collection_name = "collection_name" ,
830+ content = {
831+ "text" : "text" ,
832+ "type" : "text" ,
833+ },
834+ path = "path" ,
835+ extra_headers = {"x-stainless-retry-count" : Omit ()},
836+ )
802837
803838 assert len (response .http_request .headers .get_list ("x-stainless-retry-count" )) == 0
804839
@@ -819,9 +854,17 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
819854 return httpx .Response (500 )
820855 return httpx .Response (200 )
821856
822- respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
857+ respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
823858
824- response = client .status .with_raw_response .get_status (extra_headers = {"x-stainless-retry-count" : "42" })
859+ response = client .documents .with_raw_response .add (
860+ collection_name = "collection_name" ,
861+ content = {
862+ "text" : "text" ,
863+ "type" : "text" ,
864+ },
865+ path = "path" ,
866+ extra_headers = {"x-stainless-retry-count" : "42" },
867+ )
825868
826869 assert response .http_request .headers .get ("x-stainless-retry-count" ) == "42"
827870
@@ -1497,12 +1540,22 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte
14971540 @mock .patch ("zeroentropy._base_client.BaseClient._calculate_retry_timeout" , _low_retry_timeout )
14981541 @pytest .mark .respx (base_url = base_url )
14991542 async def test_retrying_timeout_errors_doesnt_leak (self , respx_mock : MockRouter ) -> None :
1500- respx_mock .post ("/status/get-status " ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
1543+ respx_mock .post ("/documents/add-document " ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
15011544
15021545 with pytest .raises (APITimeoutError ):
15031546 await self .client .post (
1504- "/status/get-status" ,
1505- body = cast (object , dict ()),
1547+ "/documents/add-document" ,
1548+ body = cast (
1549+ object ,
1550+ dict (
1551+ collection_name = "example_collection" ,
1552+ content = {
1553+ "type" : "text" ,
1554+ "text" : "Example Content" ,
1555+ },
1556+ path = "my_document.txt" ,
1557+ ),
1558+ ),
15061559 cast_to = httpx .Response ,
15071560 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
15081561 )
@@ -1512,12 +1565,22 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
15121565 @mock .patch ("zeroentropy._base_client.BaseClient._calculate_retry_timeout" , _low_retry_timeout )
15131566 @pytest .mark .respx (base_url = base_url )
15141567 async def test_retrying_status_errors_doesnt_leak (self , respx_mock : MockRouter ) -> None :
1515- respx_mock .post ("/status/get-status " ).mock (return_value = httpx .Response (500 ))
1568+ respx_mock .post ("/documents/add-document " ).mock (return_value = httpx .Response (500 ))
15161569
15171570 with pytest .raises (APIStatusError ):
15181571 await self .client .post (
1519- "/status/get-status" ,
1520- body = cast (object , dict ()),
1572+ "/documents/add-document" ,
1573+ body = cast (
1574+ object ,
1575+ dict (
1576+ collection_name = "example_collection" ,
1577+ content = {
1578+ "type" : "text" ,
1579+ "text" : "Example Content" ,
1580+ },
1581+ path = "my_document.txt" ,
1582+ ),
1583+ ),
15211584 cast_to = httpx .Response ,
15221585 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
15231586 )
@@ -1549,9 +1612,16 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
15491612 return httpx .Response (500 )
15501613 return httpx .Response (200 )
15511614
1552- respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
1615+ respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
15531616
1554- response = await client .status .with_raw_response .get_status ()
1617+ response = await client .documents .with_raw_response .add (
1618+ collection_name = "collection_name" ,
1619+ content = {
1620+ "text" : "text" ,
1621+ "type" : "text" ,
1622+ },
1623+ path = "path" ,
1624+ )
15551625
15561626 assert response .retries_taken == failures_before_success
15571627 assert int (response .http_request .headers .get ("x-stainless-retry-count" )) == failures_before_success
@@ -1574,9 +1644,17 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
15741644 return httpx .Response (500 )
15751645 return httpx .Response (200 )
15761646
1577- respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
1647+ respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
15781648
1579- response = await client .status .with_raw_response .get_status (extra_headers = {"x-stainless-retry-count" : Omit ()})
1649+ response = await client .documents .with_raw_response .add (
1650+ collection_name = "collection_name" ,
1651+ content = {
1652+ "text" : "text" ,
1653+ "type" : "text" ,
1654+ },
1655+ path = "path" ,
1656+ extra_headers = {"x-stainless-retry-count" : Omit ()},
1657+ )
15801658
15811659 assert len (response .http_request .headers .get_list ("x-stainless-retry-count" )) == 0
15821660
@@ -1598,9 +1676,17 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
15981676 return httpx .Response (500 )
15991677 return httpx .Response (200 )
16001678
1601- respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
1679+ respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
16021680
1603- response = await client .status .with_raw_response .get_status (extra_headers = {"x-stainless-retry-count" : "42" })
1681+ response = await client .documents .with_raw_response .add (
1682+ collection_name = "collection_name" ,
1683+ content = {
1684+ "text" : "text" ,
1685+ "type" : "text" ,
1686+ },
1687+ path = "path" ,
1688+ extra_headers = {"x-stainless-retry-count" : "42" },
1689+ )
16041690
16051691 assert response .http_request .headers .get ("x-stainless-retry-count" ) == "42"
16061692
0 commit comments