@@ -721,22 +721,12 @@ 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 ("/documents/add-document " ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
724+ respx_mock .post ("/status/get-status " ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
725725
726726 with pytest .raises (APITimeoutError ):
727727 self .client .post (
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- ),
728+ "/status/get-status" ,
729+ body = cast (object , dict ()),
740730 cast_to = httpx .Response ,
741731 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
742732 )
@@ -746,22 +736,12 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
746736 @mock .patch ("zeroentropy._base_client.BaseClient._calculate_retry_timeout" , _low_retry_timeout )
747737 @pytest .mark .respx (base_url = base_url )
748738 def test_retrying_status_errors_doesnt_leak (self , respx_mock : MockRouter ) -> None :
749- respx_mock .post ("/documents/add-document " ).mock (return_value = httpx .Response (500 ))
739+ respx_mock .post ("/status/get-status " ).mock (return_value = httpx .Response (500 ))
750740
751741 with pytest .raises (APIStatusError ):
752742 self .client .post (
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- ),
743+ "/status/get-status" ,
744+ body = cast (object , dict ()),
765745 cast_to = httpx .Response ,
766746 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
767747 )
@@ -792,16 +772,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
792772 return httpx .Response (500 )
793773 return httpx .Response (200 )
794774
795- respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
775+ respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
796776
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- )
777+ response = client .status .with_raw_response .get_status ()
805778
806779 assert response .retries_taken == failures_before_success
807780 assert int (response .http_request .headers .get ("x-stainless-retry-count" )) == failures_before_success
@@ -823,17 +796,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
823796 return httpx .Response (500 )
824797 return httpx .Response (200 )
825798
826- respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
799+ respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
827800
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- )
801+ response = client .status .with_raw_response .get_status (extra_headers = {"x-stainless-retry-count" : Omit ()})
837802
838803 assert len (response .http_request .headers .get_list ("x-stainless-retry-count" )) == 0
839804
@@ -854,17 +819,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
854819 return httpx .Response (500 )
855820 return httpx .Response (200 )
856821
857- respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
822+ respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
858823
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- )
824+ response = client .status .with_raw_response .get_status (extra_headers = {"x-stainless-retry-count" : "42" })
868825
869826 assert response .http_request .headers .get ("x-stainless-retry-count" ) == "42"
870827
@@ -1540,22 +1497,12 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte
15401497 @mock .patch ("zeroentropy._base_client.BaseClient._calculate_retry_timeout" , _low_retry_timeout )
15411498 @pytest .mark .respx (base_url = base_url )
15421499 async def test_retrying_timeout_errors_doesnt_leak (self , respx_mock : MockRouter ) -> None :
1543- respx_mock .post ("/documents/add-document " ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
1500+ respx_mock .post ("/status/get-status " ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
15441501
15451502 with pytest .raises (APITimeoutError ):
15461503 await self .client .post (
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- ),
1504+ "/status/get-status" ,
1505+ body = cast (object , dict ()),
15591506 cast_to = httpx .Response ,
15601507 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
15611508 )
@@ -1565,22 +1512,12 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
15651512 @mock .patch ("zeroentropy._base_client.BaseClient._calculate_retry_timeout" , _low_retry_timeout )
15661513 @pytest .mark .respx (base_url = base_url )
15671514 async def test_retrying_status_errors_doesnt_leak (self , respx_mock : MockRouter ) -> None :
1568- respx_mock .post ("/documents/add-document " ).mock (return_value = httpx .Response (500 ))
1515+ respx_mock .post ("/status/get-status " ).mock (return_value = httpx .Response (500 ))
15691516
15701517 with pytest .raises (APIStatusError ):
15711518 await self .client .post (
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- ),
1519+ "/status/get-status" ,
1520+ body = cast (object , dict ()),
15841521 cast_to = httpx .Response ,
15851522 options = {"headers" : {RAW_RESPONSE_HEADER : "stream" }},
15861523 )
@@ -1612,16 +1549,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
16121549 return httpx .Response (500 )
16131550 return httpx .Response (200 )
16141551
1615- respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
1552+ respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
16161553
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- )
1554+ response = await client .status .with_raw_response .get_status ()
16251555
16261556 assert response .retries_taken == failures_before_success
16271557 assert int (response .http_request .headers .get ("x-stainless-retry-count" )) == failures_before_success
@@ -1644,17 +1574,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
16441574 return httpx .Response (500 )
16451575 return httpx .Response (200 )
16461576
1647- respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
1577+ respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
16481578
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- )
1579+ response = await client .status .with_raw_response .get_status (extra_headers = {"x-stainless-retry-count" : Omit ()})
16581580
16591581 assert len (response .http_request .headers .get_list ("x-stainless-retry-count" )) == 0
16601582
@@ -1676,17 +1598,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
16761598 return httpx .Response (500 )
16771599 return httpx .Response (200 )
16781600
1679- respx_mock .post ("/documents/add-document " ).mock (side_effect = retry_handler )
1601+ respx_mock .post ("/status/get-status " ).mock (side_effect = retry_handler )
16801602
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- )
1603+ response = await client .status .with_raw_response .get_status (extra_headers = {"x-stainless-retry-count" : "42" })
16901604
16911605 assert response .http_request .headers .get ("x-stainless-retry-count" ) == "42"
16921606
0 commit comments