-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ Add RFC7162 example responses to parser tests
Note that QRESYNC isn't actually supported yet, so `VANISHED` responses are parsed as `response_data__unhandled`, which simply returns a string wrapped in `UnparsedData`.
- Loading branch information
Showing
2 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
test/net/imap/fixtures/response_parser/rfc7162_condstore_qresync_responses.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
:tests: | ||
|
||
"RFC7162 CONDSTORE 3.1.2.1. HIGHESTMODSEQ Response Code": | ||
:response: "* OK [HIGHESTMODSEQ 715194045007]\r\n" | ||
:expected: !ruby/struct:Net::IMAP::UntaggedResponse | ||
name: OK | ||
data: !ruby/struct:Net::IMAP::ResponseText | ||
code: !ruby/struct:Net::IMAP::ResponseCode | ||
name: HIGHESTMODSEQ | ||
data: 715194045007 | ||
text: '' | ||
raw_data: "* OK [HIGHESTMODSEQ 715194045007]\r\n" | ||
|
||
"RFC7162 CONDSTORE 3.1.2.2. NOMODSEQ Response Code": | ||
:response: "* OK [NOMODSEQ] Sorry, this mailbox format doesn't support | ||
modsequences\r\n" | ||
:expected: !ruby/struct:Net::IMAP::UntaggedResponse | ||
name: OK | ||
data: !ruby/struct:Net::IMAP::ResponseText | ||
code: !ruby/struct:Net::IMAP::ResponseCode | ||
name: NOMODSEQ | ||
data: | ||
text: Sorry, this mailbox format doesn't support modsequences | ||
raw_data: "* OK [NOMODSEQ] Sorry, this mailbox format doesn't support | ||
modsequences\r\n" | ||
|
||
"RFC7162 CONDSTORE 3.1.3. Example 3 (FETCH MODSEQ)": | ||
:response: "* 4 FETCH (UID 8 MODSEQ (12121230956))\r\n" | ||
:expected: !ruby/struct:Net::IMAP::UntaggedResponse | ||
name: FETCH | ||
data: !ruby/struct:Net::IMAP::FetchData | ||
seqno: 4 | ||
attr: | ||
UID: 8 | ||
MODSEQ: 12121230956 | ||
raw_data: "* 4 FETCH (UID 8 MODSEQ (12121230956))\r\n" | ||
|
||
"RFC7162 CONDSTORE 3.1.3. Example 4 (FETCH MODSEQ)": | ||
:response: "* 50 FETCH (MODSEQ (12111230048))\r\n" | ||
:expected: !ruby/struct:Net::IMAP::UntaggedResponse | ||
name: FETCH | ||
data: !ruby/struct:Net::IMAP::FetchData | ||
seqno: 50 | ||
attr: | ||
MODSEQ: 12111230048 | ||
raw_data: "* 50 FETCH (MODSEQ (12111230048))\r\n" | ||
|
||
"RFC7162 CONDSTORE 3.1.3. Example 6 (MODIFIED Response Code)": | ||
:response: "d105 OK [MODIFIED 7,9] Conditional STORE failed\r\n" | ||
:expected: !ruby/struct:Net::IMAP::TaggedResponse | ||
tag: d105 | ||
name: OK | ||
data: !ruby/struct:Net::IMAP::ResponseText | ||
code: !ruby/struct:Net::IMAP::ResponseCode | ||
name: MODIFIED | ||
data: !ruby/object:Net::IMAP::SequenceSet | ||
str: '7,9' | ||
tuples: | ||
- - 7 | ||
- 7 | ||
- - 9 | ||
- 9 | ||
text: Conditional STORE failed | ||
raw_data: "d105 OK [MODIFIED 7,9] Conditional STORE failed\r\n" | ||
|
||
"RFC7162 CONDSTORE 3.1.5. MODSEQ Search Criterion in SEARCH": | ||
:response: "* SEARCH 2 5 6 7 11 12 18 19 20 23 (MODSEQ 917162500)\r\n" | ||
:expected: !ruby/struct:Net::IMAP::UntaggedResponse | ||
name: SEARCH | ||
data: !ruby/array:Net::IMAP::SearchResult | ||
internal: | ||
- 2 | ||
- 5 | ||
- 6 | ||
- 7 | ||
- 11 | ||
- 12 | ||
- 18 | ||
- 19 | ||
- 20 | ||
- 23 | ||
ivars: | ||
:@modseq: 917162500 | ||
raw_data: "* SEARCH 2 5 6 7 11 12 18 19 20 23 (MODSEQ 917162500)\r\n" | ||
|
||
"RFC7162 CONDSTORE 3.1.7. HIGHESTMODSEQ Status Data Items": | ||
:response: "* STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292 HIGHESTMODSEQ | ||
7011231777)\r\n" | ||
:expected: !ruby/struct:Net::IMAP::UntaggedResponse | ||
name: STATUS | ||
data: !ruby/struct:Net::IMAP::StatusData | ||
mailbox: blurdybloop | ||
attr: | ||
MESSAGES: 231 | ||
UIDNEXT: 44292 | ||
HIGHESTMODSEQ: 7011231777 | ||
raw_data: "* STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292 HIGHESTMODSEQ | ||
7011231777)\r\n" | ||
|
||
"RFC7162 QRESYNC 3.2.5.1. Modification Sequence and UID Parameters": | ||
:response: "* VANISHED (EARLIER) 41,43:116,118,120:211,214:540\r\n" | ||
:expected: !ruby/struct:Net::IMAP::UntaggedResponse | ||
name: VANISHED | ||
data: !ruby/struct:Net::IMAP::UnparsedData | ||
unparsed_data: "(EARLIER) 41,43:116,118,120:211,214:540" | ||
raw_data: "* VANISHED (EARLIER) 41,43:116,118,120:211,214:540\r\n" | ||
comment: | | ||
Note that QRESYNC isn't supported yet, so the data is unparsed. | ||
"RFC7162 QRESYNC 3.2.7. EXPUNGE Command": | ||
:response: "* VANISHED 405,407,410,425\r\n" | ||
:expected: !ruby/struct:Net::IMAP::UntaggedResponse | ||
name: VANISHED | ||
data: !ruby/struct:Net::IMAP::UnparsedData | ||
unparsed_data: '405,407,410,425' | ||
raw_data: "* VANISHED 405,407,410,425\r\n" | ||
comment: | | ||
Note that QRESYNC isn't supported yet, so the data is unparsed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters