]>
diplodocus.org Git - nmh/blob - test/inc/test-pop
2 ######################################################
4 # Test POP support in inc
5 # Only tests checking of local maildrop, does not
6 # test checking of POP server.
8 ######################################################
12 if test -z "${MH_OBJ_DIR}"; then
13 srcdir
=`dirname $0`/..
/..
14 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
17 .
"$MH_OBJ_DIR/test/common.sh"
22 # Some extra stuff we need for POP support
27 arith_eval
64001 + `id -u` % 1000
30 HOME
="${MH_TEST_DIR}"; export HOME
31 netrc
="${HOME}/.netrc"
32 echo "default login ${TESTUSER} password ${TESTPASS}" > "$netrc"
35 expected
=$MH_TEST_DIR/$$.expected
36 expected_err
=$MH_TEST_DIR/$$.expected_err
37 actual
=$MH_TEST_DIR/$$.actual
38 actual_err
=$MH_TEST_DIR/$$.actual_err
39 testmessage
=$MH_TEST_DIR/testmessage
41 cat > "$testmessage" <<EOM
42 Received: From somewhere
43 From: No Such User <nosuch@example.com>
44 To: Some Other User <someother@example.com>
46 Date: Sun, 17 Dec 2006 12:13:14 -0500
48 Hey man, how's it going?
50 Hope you're doing better.
53 cat > "${testmessage}.2" <<EOM
54 Received: From somewhere
55 From: A Real User <real@example.com>
56 To: Some Other User <someother@example.com>
57 Subject: Anything new?
58 Date: Monday, 18 Dec 2006 14:13:14 -0500
60 What's been happening at your place?
63 cat > "${testmessage}.3" <<EOM
64 Received: From somewhere
65 From: Nathan Explosion <nathan@dethklok.com>
66 To: Some Other User <someother@example.com>
68 Date: Tuesday, 19 Dec 2006 4:15:16 -0500
70 Dude, nmh is totally brutal.
73 pid
=`"${MH_OBJ_DIR}/test/fakepop" "$testport" \
74 "$TESTUSER" "$TESTPASS" "$testmessage"`
76 run_test
"inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80" \
77 "Incorporating new mail into inbox...
79 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do\
81 check
"$testmessage" `mhpath +inbox 11` 'keep first'
83 # Check multiple messages at once
85 pid
=`"${MH_OBJ_DIR}/test/fakepop" "$testport" \
86 "$TESTUSER" "$TESTPASS" "$testmessage" \
87 "${testmessage}.2" "${testmessage}.3"`
89 run_test
"inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80" \
90 "Incorporating new mail into inbox...
92 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're doi
93 12 12/18 A Real User Anything new?<<What's been happening at your plac
94 13 12/19 Nathan Explosion Brutal<<Dude, nmh is totally brutal. >>"
96 check
"$testmessage" `mhpath +inbox 11` 'keep first'
97 check
"${testmessage}.2" `mhpath +inbox 12`
98 check
"${testmessage}.3" `mhpath +inbox 13`
101 pid
=`"${MH_OBJ_DIR}/test/fakepop" "$testport" \
102 "$TESTUSER" "$TESTPASS" "$testmessage"`
104 touch "$MH_TEST_DIR/inc.mbox"
105 run_test
"inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80 \
106 -pack $MH_TEST_DIR/inc.mbox" \
107 "Incorporating new mail into (null)...
109 1 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do\
111 run_test
"inc -file $MH_TEST_DIR/inc.mbox -truncate -width 80" \
112 "Incorporating new mail into inbox...
114 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do\
117 check
$testmessage `mhpath +inbox 11` 'keep first'
118 rm -f "$MH_TEST_DIR/inc.mbox" "$MH_TEST_DIR/.inc.map" "$netrc"
120 # check credentials: file
121 # Redirect stdin so that inc doesn't wait on the user if it can't
122 # read the netrc file, even though that shouldn't happen.
123 TESTUSER
=differenuser
124 TESTPASS
=differentpass
126 netrc
="${HOME}/.mhnetrc"
127 echo "default login ${TESTUSER} password ${TESTPASS}" > "$netrc"
129 echo "credentials: file:${netrc}" >>$MH
131 pid
=`"${MH_OBJ_DIR}/test/fakepop" "$testport" \
132 "$TESTUSER" "$TESTPASS" "$testmessage"`
134 touch "$MH_TEST_DIR/inc.mbox"
135 run_test
"inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 65 \
136 -pack $MH_TEST_DIR/inc.mbox" \
137 "Incorporating new mail into (null)...
139 1 12/17 No Such User Hello<<Hey man, how's it going? . " </dev
/null
140 run_test
"inc -file $MH_TEST_DIR/inc.mbox -truncate -width 65" \
141 "Incorporating new mail into inbox...
143 11+ 12/17 No Such User Hello<<Hey man, how's it going? . " </dev
/null
145 check
$testmessage `mhpath +inbox 11`
146 rm -f "$MH_TEST_DIR/inc.mbox" "$MH_TEST_DIR/.inc.map" "$netrc"