@@ -483,29 +483,37 @@ def test_search_e2e_modifiers_from_search_modifier(
483483 def test_search_e2e_modifiers_to_search_modifier (
484484 self , setup_search , api_client , test_url , test_threads
485485 ):
486- """Test searching with the 'to:' modifier."""
486+ """
487+ Test searching with the 'to:' modifier.
488+ It looks for messages where recipient fields (to, cc, bcc) contain the given email address.
489+ """
487490
488491 # Test English version
489- response = api_client .get (f"{ test_url } ?search=to:sarah @example.com" )
492+ response = api_client .get (f"{ test_url } ?search=to:robert @example.com" )
490493
491494 # Verify response
492495 assert response .status_code == 200
493496
494497 # Check if the correct threads are found
498+ assert len (response .data ["results" ]) == 2
495499 thread_ids = [t ["id" ] for t in response .data ["results" ]]
496- assert str (test_threads ["thread1" ].id ) in thread_ids
500+ assert str (test_threads ["thread2" ].id ) in thread_ids
501+ assert str (test_threads ["thread10" ].id ) in thread_ids
497502
498503 # Test French version
499- response = api_client .get (f"{ test_url } ?search=à:sarah @example.com" )
504+ response = api_client .get (f"{ test_url } ?search=à:robert @example.com" )
500505
501506 # Verify the same results
502507 assert response .status_code == 200
508+ assert len (response .data ["results" ]) == 2
503509 thread_ids = [t ["id" ] for t in response .data ["results" ]]
504- assert str (test_threads ["thread1" ].id ) in thread_ids
510+ assert str (test_threads ["thread2" ].id ) in thread_ids
511+ assert str (test_threads ["thread10" ].id ) in thread_ids
505512
506513 def test_search_e2e_modifiers_to_search_modifier_substring (
507514 self , setup_search , api_client , test_url , test_threads
508515 ):
516+ """Test searching with the 'to:' modifier with substring search."""
509517 # Test substring search
510518 response = api_client .get (f"{ test_url } ?search=to:@example.com" )
511519 assert response .status_code == 200
@@ -519,6 +527,31 @@ def test_search_e2e_modifiers_to_search_modifier_substring(
519527 assert response .status_code == 200
520528 assert len (response .data ["results" ]) == 0
521529
530+ def test_search_e2e_modifiers_to_exact_search_modifier (
531+ self , setup_search , api_client , test_url , test_threads
532+ ):
533+ """Test searching with the 'to_exact:' modifier."""
534+
535+ # Test English version
536+ response = api_client .get (f"{ test_url } ?search=to_exact:robert@example.com" )
537+
538+ # Verify response
539+ assert response .status_code == 200
540+
541+ # Check if the correct threads are found
542+ assert len (response .data ["results" ]) == 1
543+ thread_ids = [t ["id" ] for t in response .data ["results" ]]
544+ assert str (test_threads ["thread10" ].id ) in thread_ids
545+
546+ # Test French version
547+ response = api_client .get (f"{ test_url } ?search=à_exact:robert@example.com" )
548+
549+ # Verify the same results
550+ assert response .status_code == 200
551+ assert len (response .data ["results" ]) == 1
552+ thread_ids = [t ["id" ] for t in response .data ["results" ]]
553+ assert str (test_threads ["thread10" ].id ) in thread_ids
554+
522555 def test_search_e2e_modifiers_cc_search_modifier (
523556 self , setup_search , api_client , test_url , test_threads
524557 ):
0 commit comments