Skip to content

Commit 9e1298d

Browse files
committed
♻️ Move ACL response parser tests to yaml
1 parent 4da36c6 commit 9e1298d

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
:tests:
3+
test_acl_response:
4+
:comment: |
5+
[Bug #8281]
6+
:response: "* ACL \"INBOX/share\" \"[email protected]\"
7+
lrswickxteda\r\n"
8+
:expected: !ruby/struct:Net::IMAP::UntaggedResponse
9+
name: ACL
10+
data:
11+
- !ruby/struct:Net::IMAP::MailboxACLItem
12+
13+
rights: lrswickxteda
14+
mailbox: INBOX/share
15+
raw_data: "* ACL \"INBOX/share\" \"[email protected]\"
16+
lrswickxteda\r\n"

test/net/imap/test_imap_response_parser.rb

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ def teardown
4545
# RFC 2971: ID response
4646
generate_tests_from fixture_file: "id_responses.yml"
4747

48+
# RFC 4314: ACL response (TODO: LISTRIGHTS and MYRIGHTS responses)
49+
generate_tests_from fixture_file: "acl_responses.yml"
50+
4851
# RFC 4315: UIDPLUS extension, APPENDUID and COPYUID response codes
4952
generate_tests_from fixture_file: "uidplus_extension.yml"
5053

@@ -127,20 +130,6 @@ def assert_parseable(s)
127130
parser.parse(s.gsub(/\n/, "\r\n"))
128131
end
129132

130-
# [Bug #8281]
131-
def test_acl
132-
parser = Net::IMAP::ResponseParser.new
133-
response = parser.parse(<<EOF.gsub(/\n/, "\r\n"))
134-
* ACL "INBOX/share" "[email protected]" lrswickxteda
135-
EOF
136-
assert_equal("ACL", response.name)
137-
assert_equal(1, response.data.length)
138-
assert_equal("INBOX/share", response.data[0].mailbox)
139-
assert_equal("[email protected]",
140-
response.data[0].user)
141-
assert_equal("lrswickxteda", response.data[0].rights)
142-
end
143-
144133
def test_enable
145134
parser = Net::IMAP::ResponseParser.new
146135
response = parser.parse("* ENABLED SMTPUTF8\r\n")

0 commit comments

Comments
 (0)