File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
backend/tests/daily/connectors/imap Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
from pydantic import BaseModel
2
2
3
3
from onyx .connectors .models import Document
4
+ from tests .daily .connectors .utils import to_text_sections
4
5
5
6
6
7
class EmailDoc (BaseModel ):
7
8
subject : str
9
+ recipients : set [str ]
10
+ body : str
8
11
9
12
@classmethod
10
13
def from_doc (cls , document : Document ) -> "EmailDoc" :
11
- assert document .title # Acceptable since this will only be used in tests.
14
+ # Acceptable to perform assertions since this class is only used in tests.
15
+ assert document .title
16
+ assert document .external_access
17
+
18
+ body = " " .join (to_text_sections (iterator = iter (document .sections )))
12
19
13
20
return cls (
14
21
subject = document .title ,
22
+ recipients = document .external_access .external_user_emails ,
23
+ body = body ,
15
24
)
Original file line number Diff line number Diff line change @@ -49,9 +49,13 @@ def imap_connector() -> ImapConnector:
49
49
[
50
50
EmailDoc (
51
51
subject = "Testing" ,
52
+ recipients = set (["admin@onyx-test.com" ]),
53
+ body = "Hello, testing." ,
52
54
),
53
55
EmailDoc (
54
56
subject = "Hello world" ,
57
+ recipients = set (["admin@onyx-test.com" , "r@rabh.io" ]),
58
+ body = 'Hello world, this is an email that contains multiple "To" recipients.' ,
55
59
),
56
60
]
57
61
],
You can’t perform that action at this time.
0 commit comments