+
    Vi'                         R t ^ RIt^ RIHtHt ^ RIHtHt ^ RIH	t	H
t
 ^ RIHt  ! R R]4      t ! R R	]4      t ! R
 R]P                  4      t]R8X  d   ]P$                  ! 4        R# R# )z:
Integration tests for agent method with mocked requests.
N)patch	MagicMock)	BaseModelField)ListOptional)FirecrawlAppc                   f   a  ] tR t^t o ]! RR7      t]! RRR7      t]! RRR7      tV 3R ltRt	V t
R# )FounderzFull name of the founderdescriptionNzRole or positionzProfessional backgroundc                ^   < V ^8  d   Qh/ S[ ;R&   S[S[ ,          ;R&   S[S[ ,          ;R&   # )   namerole
background)strr   )format__classdict__s   "[/home/ubuntu/hermes-agent/venv/lib/python3.14/site-packages/tests/test_agent_integration.py__annotate__Founder.__annotate__   s0     
= 
3-E  R      )__name__
__module____qualname____firstlineno__r   r   r   r   __annotate_func____static_attributes____classdictcell__r   s   @r   r
   r
      s1     "<=D2DED %d8Q RJ  r   r
   c                   >   a  ] tR t^t o ]! RR7      tV 3R ltRtV tR# )FoundersSchemazList of foundersr   c                6   < V ^8  d   Qh/ S[ S[,          ;R&   # )r   founders)r   r
   )r   r   s   "r   r   FoundersSchema.__annotate__   s     7mC r   r   N)	r   r   r   r   r   r%   r   r   r    r!   s   @r   r#   r#      s     #0BCH  r   r#   c                     a  ] tR t^t o Rt]! R4      ]! R4      R 4       4       t]! R4      R 4       t]! R4      R 4       t]! R4      R 4       t	]! R4      R 4       t
]! R4      ]! R4      R	 4       4       t]! R4      R
 4       tRtV tR# )	TestAgentz#Integration tests for agent method.z,firecrawl.v2.utils.http_client.requests.postz+firecrawl.v2.utils.http_client.requests.getc                   \        4       pRVn        ^Vn        RRRRRR/VP                  n        W2n        \        4       pRVn        ^Vn        RRRRRRRR	R
RRRRR/R
RRRRR/./R^
RR/VP                  n        WAn        \        RR7      pVP                  R\        R7      pVP                  4        VP                  pRV^,          9   d   V^,          R,          MV^ ,          ^ ,          pR\        V4      9   g   Q hV^,          R,          p	V	R,          R8X  g   Q hRV	9   g   Q hV	R,          R,          R 8X  g   Q hR	V	R,          R!,          9   g   Q hVP                  4        VP                  R8X  g   Q hVP                  f   Q hR"# )#zTest basic agent call.Tsuccessidtest-agent-123status
processing	completeddatar%   r   zJohn Doer   CEOr   zTech entrepreneurz
Jane SmithCTOzSoftware engineercreditsUsed	expiresAtz2024-01-01T00:00:00Ztest-api-keyapi_keyzFind the founders of Firecrawlpromptschemaurl	/v2/agentjsonr9   r:   typeobject
propertiesN)r   okstatus_coder=   return_valuer   agentr#   assert_called_once	call_argsr   assert_calledr-   r0   )
selfmock_get	mock_postmock_start_responsemock_status_responseappresultpost_call_argspost_urlrequest_bodys
   &&&       r   test_agent_basicTestAgent.test_agent_basic   s   
 (k!%*-'t"l1
  -
 "5  ){"&+.(t"kZFYZ\65,H[\ 2/2
!!. !5>23!  
 	$$&",,/4q8I/I>!$U+~^_O`abOcc(m+++ &a(0H%)IIII<'''H%f-999\(3LAAAA 	  }}+++{{&&&r   c           
     D   \        4       pRVn        ^Vn        RRRRRRR//VP                  n        W!n        \        RR	7      pVP                  R
R.RRRRRRR///R7      pVP                  pV^,          R,          pVR,          R
R.8X  g   Q hVR,          R8X  g   Q hR# )zTest agent call with URLs.Tr*   r-   r/   r0   rN   doner5   r6   https://example.comzhttps://test.comzExtract informationr>   r?   r@   infostring)urlsr9   r:   r=   rY   r9   Nr   rA   rB   r=   rC   r   rD   rF   )rH   rJ   mock_responserM   rN   rO   rQ   s   &&     r   test_agent_with_urlsTestAgent.test_agent_with_urlsV   s     "$'!tkXv&+
'
 "/>2');<(HlVfh=O4PQ  
 #,,%a(0F#(=?Q'RRRRH%)>>>>r   c                &   \        4       pRVn        ^Vn        RRRRRRR//VP                  n        W!n        RR	R
RRR/RRR///p\        RR7      pVP                  RVR7      pVP                  pV^,          R,          pVR,          V8X  g   Q hR# )z!Test agent call with dict schema.Tr*   r-   r/   r0   rN   rU   r>   r?   r@   r   rX   ageintegerr5   r6   zExtract person datar8   r=   r:   NrZ   )rH   rJ   r[   r:   rM   rN   rO   rQ   s   &&      r   test_agent_with_dict_schema%TestAgent.test_agent_with_dict_schemap   s     "$'!tkXv&+
'
 "/ H*	*
 >2(  
 #,,%a(0H%///r   c                   \        4       pRVn        ^Vn        RRRRRRR//VP                  n        W!n        RR	/pR
.p\        RR7      pVP                  VRVR^2R^^R7      pVP                  pV^,          R,          pVR,          R8X  g   Q hVR,          V8X  g   Q hVR,          V8X  g   Q hVR,          R8X  g   Q hVR,          ^28X  g   Q hVR,          RJ g   Q hR# )z$Test agent call with all parameters.Tr*   r-   r/   r0   rN   rU   r>   r?   rV   r5   r6   zComplete testztest-integration)rY   r9   r:   integrationmax_creditsstrict_constrain_to_urlspoll_intervaltimeoutr=   r9   rY   r:   rd   
maxCreditsstrictConstrainToURLsNrZ   )	rH   rJ   r[   r:   rY   rM   rN   rO   rQ   s	   &&       r   test_agent_with_all_params$TestAgent.test_agent_with_all_params   s    "$'!tkXv&+
'
 "/(#%&>2"*%)  	
 #,,%a(0H%888F#t+++H%///M*.@@@@L)R///34<<<r   c                   \        4       pRVn        ^Vn        RRRRRRR//VP                  n        W!n        \        RR	7      pVP                  R
\        R7      pVP                  pV^,          R,          pRV9   g   Q hVR,          pVR,          R8X  g   Q hRV9   g   Q hRVR,          9   g   Q hVR,          R,          R,          R8X  g   Q hR# )z3Test that Pydantic schemas are properly normalized.Tr*   r-   r/   r0   rN   rU   r5   r6   zFind foundersr8   r=   r:   r>   r?   r@   r%   arrayN)	r   rA   rB   r=   rC   r   rD   r#   rF   )rH   rJ   r[   rM   rN   rO   rQ   r:   s   &&      r   (test_agent_pydantic_schema_normalization2TestAgent.test_agent_pydantic_schema_normalization   s     "$'!tkXv&+
'
 "/>2"!  
 #,,%a(0<'''h'f~)))v%%%VL1111l#J/77BBBr   c           	     p   \        4       pRVn        ^Vn        RRRRRR/VP                  n        W2n        \        4       pRVn        ^Vn        RRRRRRRR	R
//VP                  n        WAn        \        RRR7      pVP                  RR7      pVP                  pRV^,          9   d   V^,          P                  R4      MV^ ,          ^ ,          pR\        V4      9   g   Q hVP                  p	RV	^,          9   d   V	^,          P                  R4      MV	^ ,          ^ ,          p
R\        V
4      9   g   Q hR# )z1Test that agent requests are sent to correct URL.Tr*   r+   r,   r-   r.   r/   r0   rN   rU   r5   zhttps://api.firecrawl.dev)r7   api_urlTest promptr9   r;   r<   z/v2/agent/test-agent-123N)
r   rA   rB   r=   rC   r   rD   rF   getr   )rH   rI   rJ   rK   rL   rM   rN   rO   rP   get_call_argsget_urls   &&&        r   test_agent_url_construction%TestAgent.test_agent_url_construction   sQ   
 (k!%*-'t"l1
  -
 "5  ){"&+.(t"kXv&	2
!!. !5>;VW-0 #,,38N1<M3M>!$((/SabcSdefSgc(m+++ !**16-:J1J-"&&u-P]^_P`abPc)S\999r   c                :   \        4       pRVn        ^Vn        RRRRRRR//VP                  n        W!n        \        RR	7      pVP                  R
R7      pVP                  pV^,          R,          pRV9   g   Q hVR,          R8X  g   Q hVR,          R8X  g   Q hR# )z1Test that agent requests include correct headers.Tr*   r-   r/   r0   rN   rU   r5   r6   rs   rt   headersAuthorizationzBearer test-api-keyzContent-Typezapplication/jsonNrZ   )rH   rJ   r[   rM   rN   rO   r{   s   &&     r   test_agent_headersTestAgent.test_agent_headers   s     "$'!tkXv&+
'
 "/>2-0 #,, #I.')))'+@@@@~&*<<<<r   r   N)r   r   r   r   __doc__r   rR   r\   ra   rk   ro   rx   r}   r   r    r!   s   @r   r(   r(      s     -
9:
898' : ;8't 9:? ;?2 9:0 ;0> 9:#= ;#=J 9:C ;C8 9:
89$: : ;$:L 9:= ;=r   r(   __main__)r   unittestunittest.mockr   r   pydanticr   r   typingr   r   	firecrawlr   r
   r#   TestCaser(   r   mainr   r   r   <module>r      sd     * % ! "Si SDY Dy=!! y=x zMMO r   