read.exp
5.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010-2012, 2014-2015 Free Software
# Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
pop3d_start
pop3d_auth "user!passwd" "guessme"
## Test STAT command
pop3d_test "STAT" "+OK 95 34469"
## Test LIST command. This will be used twice.
proc test_list {} {
pop3d_test "LIST" \
"+OK" \
"1 311" \
"2 321" \
"3 316" \
"4 345" \
"5 362" \
"6 378" \
"7 325" \
"8 368" \
"9 354" \
"10 323" \
"11 358" \
"12 307" \
"13 348" \
"14 379" \
"15 421" \
"16 397" \
"17 454" \
"18 340" \
"19 320" \
"20 307" \
"21 357" \
"22 321" \
"23 397" \
"24 332" \
"25 415" \
"26 358" \
"27 390" \
"28 334" \
"29 330" \
"30 337" \
"31 375" \
"32 329" \
"33 333" \
"34 325" \
"35 302" \
"36 417" \
"37 383" \
"38 332" \
"39 367" \
"40 369" \
"41 662" \
"42 341" \
"43 388" \
"44 390" \
"45 333" \
"46 548" \
"47 334" \
"48 424" \
"49 359" \
"50 437" \
"51 328" \
"52 383" \
"53 376" \
"54 389" \
"55 336" \
"56 336" \
"57 352" \
"58 438" \
"59 337" \
"60 408" \
"61 393" \
"62 335" \
"63 331" \
"64 386" \
"65 483" \
"66 324" \
"67 323" \
"68 362" \
"69 325" \
"70 348" \
"71 311" \
"72 341" \
"73 369" \
"74 327" \
"75 340" \
"76 345" \
"77 324" \
"78 324" \
"79 369" \
"80 375" \
"81 389" \
"82 321" \
"83 310" \
"84 362" \
"85 365" \
"86 413" \
"87 327" \
"88 332" \
"89 401" \
"90 316" \
"91 310" \
"92 500" \
"93 341" \
"94 321" \
"95 390" \
"."
}
## Actually test LIST
test_list
## Test RETRY on an existing message
pop3d_test "RETR 1" \
"+OK" \
"Received: (from hare@wonder.land) "\
" by wonder.land id 3301"\
" for alice@wonder.land; Mon, 29 Jul 2002 22:00:06 +0100"\
"Date: Mon, 29 Jul 2002 22:00:01 +0100"\
"From: March Hare <hare@wonder.land>"\
"Message-Id: <200207292200.3301@wonder.land>"\
"To: Alice <alice@wonder.land>"\
"Subject: Invitation"\
""\
"Have some wine"\
"."
## Test TOP command
pop3d_test "TOP 48" \
"-ERR Invalid arguments"
pop3d_test "TOP 48 2" \
"+OK" \
"Received: (from hatter@wonder.land) "\
" by wonder.land id 3348"\
" for alice@wonder.land; Mon, 29 Jul 2002 22:00:53 +0100"\
"Date: Mon, 29 Jul 2002 22:00:48 +0100"\
"From: Hatter <hatter@wonder.land>"\
"Message-Id: <200207292200.3348@wonder.land>"\
"To: Alice <alice@wonder.land>"\
"Subject: Re: Discussing Time"\
"" \
"It goes on, you know in this way:--" \
"" \
"."
pop3d_test "TOP 48 3" \
"+OK" \
"Received: (from hatter@wonder.land) "\
" by wonder.land id 3348"\
" for alice@wonder.land; Mon, 29 Jul 2002 22:00:53 +0100"\
"Date: Mon, 29 Jul 2002 22:00:48 +0100"\
"From: Hatter <hatter@wonder.land>"\
"Message-Id: <200207292200.3348@wonder.land>"\
"To: Alice <alice@wonder.land>"\
"Subject: Re: Discussing Time"\
"" \
"It goes on, you know in this way:--" \
"" \
"\"Up above the world you fly," \
"."
pop3d_test "TOP 48 4" \
"+OK" \
"Received: (from hatter@wonder.land) "\
" by wonder.land id 3348"\
" for alice@wonder.land; Mon, 29 Jul 2002 22:00:53 +0100"\
"Date: Mon, 29 Jul 2002 22:00:48 +0100"\
"From: Hatter <hatter@wonder.land>"\
"Message-Id: <200207292200.3348@wonder.land>"\
"To: Alice <alice@wonder.land>"\
"Subject: Re: Discussing Time"\
"" \
"It goes on, you know in this way:--" \
"" \
"\"Up above the world you fly," \
"Like a tea-tray in the sky." \
"."
pop3d_test "TOP 48 1000" \
"+OK" \
"Received: (from hatter@wonder.land) "\
" by wonder.land id 3348"\
" for alice@wonder.land; Mon, 29 Jul 2002 22:00:53 +0100"\
"Date: Mon, 29 Jul 2002 22:00:48 +0100"\
"From: Hatter <hatter@wonder.land>"\
"Message-Id: <200207292200.3348@wonder.land>"\
"To: Alice <alice@wonder.land>"\
"Subject: Re: Discussing Time"\
"" \
"It goes on, you know in this way:--" \
"" \
"\"Up above the world you fly," \
"Like a tea-tray in the sky." \
"Twinkle, twinkle--\"'" \
"."
## Test DELE -- RETR -- RSET -- RETR
pop3d_test "DELE 2" \
"+OK Message 2 marked"
pop3d_test "RETR 2" \
"-ERR Message has been deleted"
pop3d_test "RSET" "+OK"
pop3d_test "RETR 2" \
"+OK" \
"Received: (from alice@wonder.land) "\
" by wonder.land id 3302"\
" for hare@wonder.land; Mon, 29 Jul 2002 22:00:07 +0100"\
"Date: Mon, 29 Jul 2002 22:00:02 +0100"\
"From: Alice <alice@wonder.land>"\
"Message-Id: <200207292200.3302@wonder.land>"\
"To: March Hare <hare@wonder.land>"\
"Subject: Re: Invitation"\
""\
"I don't see any wine"\
"."
## Delete all messages
for {set i 1} {$i <= 95} {incr i} {
pop3d_test "DELE $i" "+OK Message $i marked"
}
## This should produce empty output
pop3d_test "LIST" \
"+OK" \
"."
## Restore deleted messages
pop3d_test "RSET" "+OK"
## Test LIST again
test_list
#end of read.exp